github-actions[bot] commented on code in PR #65664:
URL: https://github.com/apache/doris/pull/65664#discussion_r3636267389
##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/rewrite/DistinctAggStrategySelector.java:
##########
@@ -119,19 +119,20 @@ public Plan visitLogicalAggregate(LogicalAggregate<?
extends Plan> agg, Distinct
}
private boolean shouldUseMultiDistinct(LogicalAggregate<? extends Plan>
agg) {
- boolean mustUseCte =
AggregateUtils.containsCountDistinctMultiExpr(agg);
+ boolean mustUseCte =
AggregateUtils.containsNotSupportMultiDistinctFunction(agg);
Review Comment:
[P1] Preserve a physical plan for scalar phase-TWO aggregates
This broad CTE gate also catches `OrthogonalBitmapExprCalculate` and
`OrthogonalBitmapExprCalculateCount`; both preserve `DISTINCT` but support only
`AggregatePhase.TWO`. For a scalar query containing one of these plus a
different DISTINCT group—for example
`bitmap_to_string(orthogonal_bitmap_expr_calculate(DISTINCT user_id, tag,
'(100&200)'))` together with `array_agg(DISTINCT id)`—the split creates a
scalar one-group branch. Its only matching aggregate implementation is
`SplitAggMultiPhaseWithoutGbyKey`: final-multi rejects these classes, while the
remaining paths require phase THREE or FOUR, so no physical alternative is
produced. The grouped rule has a phase-TWO path, but the scalar rule does not.
Please either keep such functions out of this route or add a scalar phase-TWO
lowering and regression.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]