mirror of https://github.com/apache/druid.git
Fix aggregatorFactory meta merge exception (#7504)
This commit is contained in:
parent
11a7e91a73
commit
3e25b75c3f
|
@ -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;
|
||||
|
@ -51,6 +53,23 @@ public class HllSketchMergeAggregatorFactory extends HllSketchAggregatorFactory
|
|||
super(name, fieldName, lgK, tgtHllType);
|
||||
}
|
||||
|
||||
@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()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue