You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by jo...@apache.org on 2019/04/24 21:08:55 UTC

[incubator-druid] branch master updated: Fix aggregatorFactory meta merge exception (#7504)

This is an automated email from the ASF dual-hosted git repository.

jonwei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 3e25b75  Fix aggregatorFactory meta merge exception (#7504)
3e25b75 is described below

commit 3e25b75c3fc09a84b322226746008ae3778832db
Author: es1220 <eu...@navercorp.com>
AuthorDate: Thu Apr 25 06:08:46 2019 +0900

    Fix aggregatorFactory meta merge exception (#7504)
---
 .../hll/HllSketchMergeAggregatorFactory.java          | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchMergeAggregatorFactory.java b/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchMergeAggregatorFactory.java
index f1a0b1a..b82b35b 100644
--- a/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchMergeAggregatorFactory.java
+++ b/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchMergeAggregatorFactory.java
@@ -25,6 +25,8 @@ import com.yahoo.sketches.hll.HllSketch;
 import com.yahoo.sketches.hll.TgtHllType;
 import com.yahoo.sketches.hll.Union;
 import org.apache.druid.query.aggregation.Aggregator;
+import org.apache.druid.query.aggregation.AggregatorFactory;
+import org.apache.druid.query.aggregation.AggregatorFactoryNotMergeableException;
 import org.apache.druid.query.aggregation.AggregatorUtil;
 import org.apache.druid.query.aggregation.BufferAggregator;
 import org.apache.druid.segment.ColumnSelectorFactory;
@@ -52,6 +54,23 @@ public class HllSketchMergeAggregatorFactory extends HllSketchAggregatorFactory
   }
 
   @Override
+  public AggregatorFactory getMergingFactory(AggregatorFactory other) throws AggregatorFactoryNotMergeableException
+  {
+    if (other.getName().equals(this.getName()) && other instanceof HllSketchMergeAggregatorFactory) {
+      HllSketchMergeAggregatorFactory castedOther = (HllSketchMergeAggregatorFactory) other;
+
+      return new HllSketchMergeAggregatorFactory(
+              getName(),
+              getName(),
+              Math.max(getLgK(), castedOther.getLgK()),
+              getTgtHllType().compareTo(castedOther.getTgtHllType()) < 0 ? castedOther.getTgtHllType() : getTgtHllType()
+      );
+    } else {
+      throw new AggregatorFactoryNotMergeableException(this, other);
+    }
+  }
+
+  @Override
   public String getTypeName()
   {
     return HllSketchModule.MERGE_TYPE_NAME;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org