[fix](Nereids): TransposeSemiJoinAgg can't apply in Scalar Agg (#28434)

Scalar Agg shouldn't be pushdown, it will cause wrong result
This commit is contained in:
jakevin
2023-12-15 16:18:16 +08:00
committed by GitHub
parent 8986bb6bb4
commit 0f93ee8793
2 changed files with 16 additions and 0 deletions

View File

@ -51,6 +51,10 @@ public class TransposeSemiJoinAgg extends OneRewriteRuleFactory {
public static boolean canTranspose(LogicalAggregate<? extends Plan> aggregate,
LogicalJoin<? extends Plan, ? extends Plan> join) {
Set<Slot> canPushDownSlots = PushDownFilterThroughAggregation.getCanPushDownSlots(aggregate);
// avoid push down scalar agg.
if (canPushDownSlots.isEmpty()) {
return false;
}
Set<Slot> leftConditionSlot = join.getLeftConditionSlot();
return canPushDownSlots.containsAll(leftConditionSlot);
}