diff --git a/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchEstimatePostAggregator.java b/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchEstimatePostAggregator.java index 6bb908dff6a..496f7afb69f 100644 --- a/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchEstimatePostAggregator.java +++ b/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchEstimatePostAggregator.java @@ -141,9 +141,18 @@ public class SketchEstimatePostAggregator implements PostAggregator if (!name.equals(that.name)) { return false; } - if (errorBoundsStdDev != that.errorBoundsStdDev) { + + if (errorBoundsStdDev == null ^ that.errorBoundsStdDev == null) { + // one of the two stddevs (not both) are null return false; } + + if (errorBoundsStdDev != null && that.errorBoundsStdDev != null && + errorBoundsStdDev.intValue() != that.errorBoundsStdDev.intValue()) { + // neither stddevs are null, Integer values don't match + return false; + } + return field.equals(that.field); } diff --git a/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchMergeAggregatorFactory.java b/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchMergeAggregatorFactory.java index b2514f754a8..5382562dd86 100644 --- a/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchMergeAggregatorFactory.java +++ b/extensions-core/datasketches/src/main/java/io/druid/query/aggregation/datasketches/theta/SketchMergeAggregatorFactory.java @@ -161,11 +161,19 @@ public class SketchMergeAggregatorFactory extends SketchAggregatorFactory if (shouldFinalize != that.shouldFinalize) { return false; } - if (errorBoundsStdDev != that.errorBoundsStdDev) { + + if (errorBoundsStdDev == null ^ that.errorBoundsStdDev == null) { + // one of the two stddevs (not both) are null return false; } - return isInputThetaSketch == that.isInputThetaSketch; + if (errorBoundsStdDev != null && that.errorBoundsStdDev != null && + errorBoundsStdDev.intValue() != that.errorBoundsStdDev.intValue()) { + // neither stddevs are null, Integer values don't match + return false; + } + + return isInputThetaSketch == that.isInputThetaSketch; } @Override