diff --git a/processing/src/main/java/io/druid/query/aggregation/hyperloglog/HyperUniqueFinalizingPostAggregator.java b/processing/src/main/java/io/druid/query/aggregation/hyperloglog/HyperUniqueFinalizingPostAggregator.java index dd212df3f8d..e84bb5ab5fc 100644 --- a/processing/src/main/java/io/druid/query/aggregation/hyperloglog/HyperUniqueFinalizingPostAggregator.java +++ b/processing/src/main/java/io/druid/query/aggregation/hyperloglog/HyperUniqueFinalizingPostAggregator.java @@ -89,4 +89,39 @@ public class HyperUniqueFinalizingPostAggregator implements PostAggregator { return fieldName; } + + @Override + public boolean equals(Object o) + { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + + HyperUniqueFinalizingPostAggregator that = (HyperUniqueFinalizingPostAggregator) o; + + if (name != null ? !name.equals(that.name) : that.name != null) { + return false; + } + return fieldName != null ? fieldName.equals(that.fieldName) : that.fieldName == null; + } + + @Override + public int hashCode() + { + int result = name != null ? name.hashCode() : 0; + result = 31 * result + (fieldName != null ? fieldName.hashCode() : 0); + return result; + } + + @Override + public String toString() + { + return "HyperUniqueFinalizingPostAggregator{" + + "name='" + name + '\'' + + ", fieldName='" + fieldName + '\'' + + '}'; + } } diff --git a/processing/src/main/java/io/druid/query/extraction/TimeFormatExtractionFn.java b/processing/src/main/java/io/druid/query/extraction/TimeFormatExtractionFn.java index 31ae02ac918..4925246fc64 100644 --- a/processing/src/main/java/io/druid/query/extraction/TimeFormatExtractionFn.java +++ b/processing/src/main/java/io/druid/query/extraction/TimeFormatExtractionFn.java @@ -34,8 +34,8 @@ import java.util.Locale; public class TimeFormatExtractionFn implements ExtractionFn { - private final DateTimeZone tz; private final String format; + private final DateTimeZone tz; private final Locale locale; private final QueryGranularity granularity; private final DateTimeFormatter formatter; @@ -161,4 +161,10 @@ public class TimeFormatExtractionFn implements ExtractionFn result = 31 * result + granularity.hashCode(); return result; } + + @Override + public String toString() + { + return String.format("timeFormat(\"%s\", %s, %s, %s)", format, tz, locale, granularity); + } } diff --git a/processing/src/main/java/io/druid/query/filter/InDimFilter.java b/processing/src/main/java/io/druid/query/filter/InDimFilter.java index cdf649366a5..8d6b25053f5 100644 --- a/processing/src/main/java/io/druid/query/filter/InDimFilter.java +++ b/processing/src/main/java/io/druid/query/filter/InDimFilter.java @@ -22,6 +22,7 @@ package io.druid.query.filter; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.base.Function; +import com.google.common.base.Joiner; import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.google.common.base.Supplier; @@ -40,6 +41,7 @@ import io.druid.segment.filter.InFilter; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Objects; @@ -59,7 +61,7 @@ public class InDimFilter implements DimFilter @JsonCreator public InDimFilter( @JsonProperty("dimension") String dimension, - @JsonProperty("values") List values, + @JsonProperty("values") Collection values, @JsonProperty("extractionFn") ExtractionFn extractionFn ) { @@ -227,6 +229,26 @@ public class InDimFilter implements DimFilter return result; } + @Override + public String toString() + { + final StringBuilder builder = new StringBuilder(); + + if (extractionFn != null) { + builder.append(extractionFn).append("("); + } + + builder.append(dimension); + + if (extractionFn != null) { + builder.append(")"); + } + + builder.append(" IN (").append(Joiner.on(", ").join(values)).append(")"); + + return builder.toString(); + } + // As the set of filtered values can be large, parsing them as longs should be done only if needed, and only once. // Pass in a common long predicate supplier to all filters created by .toFilter(), so that // we only compute the long hashset/array once per query. diff --git a/processing/src/main/java/io/druid/query/topn/DimensionTopNMetricSpec.java b/processing/src/main/java/io/druid/query/topn/DimensionTopNMetricSpec.java index 686d1add701..6ffae4ab945 100644 --- a/processing/src/main/java/io/druid/query/topn/DimensionTopNMetricSpec.java +++ b/processing/src/main/java/io/druid/query/topn/DimensionTopNMetricSpec.java @@ -146,7 +146,7 @@ public class DimensionTopNMetricSpec implements TopNMetricSpec { return "DimensionTopNMetricSpec{" + "previousStop='" + previousStop + '\'' + - "ordering='" + ordering + '\'' + + ", ordering=" + ordering + '}'; } diff --git a/processing/src/main/java/io/druid/query/topn/InvertedTopNMetricSpec.java b/processing/src/main/java/io/druid/query/topn/InvertedTopNMetricSpec.java index ceee9ae8c36..9332b60ef09 100644 --- a/processing/src/main/java/io/druid/query/topn/InvertedTopNMetricSpec.java +++ b/processing/src/main/java/io/druid/query/topn/InvertedTopNMetricSpec.java @@ -165,4 +165,12 @@ public class InvertedTopNMetricSpec implements TopNMetricSpec { return delegate != null ? delegate.hashCode() : 0; } + + @Override + public String toString() + { + return "InvertedTopNMetricSpec{" + + "delegate=" + delegate + + '}'; + } }