Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import java.util.List;
import java.util.stream.Collectors;
import org.apache.calcite.plan.RelOptRule;
import org.apache.calcite.plan.RelOptRuleCall;
import org.apache.calcite.rel.RelNode;
import org.apache.calcite.rel.convert.ConverterRule;
import org.apache.calcite.rex.RexNode;
Expand All @@ -40,6 +41,17 @@ protected TwoPhaseAggRule(Config config) {
super(config);
}

@Override
public boolean matches(RelOptRuleCall call) {
var agg = (RwAggregate) call.rel(0);
for (var aggCall : agg.getAggCallList()) {
if (aggCall.isDistinct()) {
return false;
}
}
return true;
}

@Override
public @Nullable RelNode convert(RelNode rel) {
var agg = (RwAggregate) rel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import com.risingwave.planner.rel.physical.join.RwBatchHashJoin;
import com.risingwave.planner.rel.physical.join.RwBatchNestedLoopJoin;
import com.risingwave.planner.rel.physical.join.RwBatchSortMergeJoin;
import com.risingwave.planner.rules.distributed.agg.ShuffleAggRule;
import com.risingwave.planner.rules.distributed.agg.SingleLimitRule;
import com.risingwave.planner.rules.distributed.agg.TwoPhaseAggRule;
import com.risingwave.planner.rules.distributed.agg.TwoPhaseLimitRule;
Expand Down Expand Up @@ -163,7 +164,7 @@ private BatchRuleSets() {}
ShuffleJoinRule.INSTANCE,
// FIXME: currently cardinality estimation is inaccurate without enough statistics to
// determine shuffleAgg or 2phaseAgg
// ShuffleAggRule.INSTANCE,
ShuffleAggRule.INSTANCE,
TwoPhaseAggRule.INSTANCE,
TwoPhaseLimitRule.INSTANCE,
SingleLimitRule.INSTANCE);
Expand Down
Loading