[fix](nereids)add HllUnion and BitmapUnion for pre agg match (#27548)
This commit is contained in:
@ -40,6 +40,7 @@ import org.apache.doris.nereids.trees.expressions.SlotNotFromChildren;
|
||||
import org.apache.doris.nereids.trees.expressions.SlotReference;
|
||||
import org.apache.doris.nereids.trees.expressions.VirtualSlotReference;
|
||||
import org.apache.doris.nereids.trees.expressions.functions.agg.AggregateFunction;
|
||||
import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapUnion;
|
||||
import org.apache.doris.nereids.trees.expressions.functions.agg.BitmapUnionCount;
|
||||
import org.apache.doris.nereids.trees.expressions.functions.agg.Count;
|
||||
import org.apache.doris.nereids.trees.expressions.functions.agg.HllUnion;
|
||||
@ -882,6 +883,20 @@ public class SelectMaterializedIndexWithAggregate extends AbstractSelectMaterial
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreAggStatus visitBitmapUnion(BitmapUnion bitmapUnion, CheckContext context) {
|
||||
Expression expr = bitmapUnion.child();
|
||||
if (expr instanceof ToBitmap) {
|
||||
expr = expr.child(0);
|
||||
}
|
||||
Optional<Slot> slotOpt = ExpressionUtils.extractSlotOrCastOnSlot(expr);
|
||||
if (slotOpt.isPresent() && context.valueNameToColumn.containsKey(normalizeName(slotOpt.get().toSql()))) {
|
||||
return PreAggStatus.on();
|
||||
} else {
|
||||
return PreAggStatus.off("invalid bitmap_union: " + bitmapUnion.toSql());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreAggStatus visitHllUnionAgg(HllUnionAgg hllUnionAgg, CheckContext context) {
|
||||
Optional<Slot> slotOpt = ExpressionUtils.extractSlotOrCastOnSlot(hllUnionAgg.child());
|
||||
@ -892,6 +907,16 @@ public class SelectMaterializedIndexWithAggregate extends AbstractSelectMaterial
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PreAggStatus visitHllUnion(HllUnion hllUnion, CheckContext context) {
|
||||
Optional<Slot> slotOpt = ExpressionUtils.extractSlotOrCastOnSlot(hllUnion.child());
|
||||
if (slotOpt.isPresent() && context.valueNameToColumn.containsKey(normalizeName(slotOpt.get().toSql()))) {
|
||||
return PreAggStatus.on();
|
||||
} else {
|
||||
return PreAggStatus.off("invalid hll_union: " + hllUnion.toSql());
|
||||
}
|
||||
}
|
||||
|
||||
private PreAggStatus checkAggFunc(
|
||||
AggregateFunction aggFunc,
|
||||
AggregateType matchingAggType,
|
||||
|
||||
Reference in New Issue
Block a user