HappenLee commented on code in PR #66942:
URL: https://github.com/apache/doris/pull/66942#discussion_r3843373903


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/AggCombinerFunctionBuilder.java:
##########
@@ -159,7 +181,8 @@ public String parameterDisplayString() {
 
     public static boolean isAggStateCombinator(String name) {
         return name.toLowerCase().endsWith(STATE_SUFFIX) || 
name.toLowerCase().endsWith(MERGE_SUFFIX)
-                || name.toLowerCase().endsWith(UNION_SUFFIX) || 
name.toLowerCase().endsWith(FOREACH_SUFFIX);
+                || name.toLowerCase().endsWith(UNION_SUFFIX) || 
name.toLowerCase().endsWith(COMBINE_SUFFIX)

Review Comment:
   Fixed in ccbda7c233d. `FunctionRegistry.isAggregateFunction()` now falls 
back from an unregistered `_combine` name to the exact nested built-in 
aggregate while preserving UDF precedence. Added coverage for `avg_combine` vs. 
scalar `abs_combine`, plus HAVING/ORDER BY alias-collision binding.



##########
be/src/exprs/vectorized_agg_fn.cpp:
##########
@@ -256,7 +292,7 @@ Status AggFnEvaluator::prepare(RuntimeState* state, const 
RowDescriptor& desc,
                                                    _sort_description, state);
     }
 
-    if (_fn.name.function_name == "ai_agg") {
+    if (_fn.name.function_name.starts_with("ai_agg")) {

Review Comment:
   Fixed in ccbda7c233d. Restored the exact `ai_agg` name check, so unrelated 
UDAFs such as `ai_agg_custom` no longer receive the AI-only QueryContext setup.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/ConvertAggStateCast.java:
##########
@@ -59,7 +60,7 @@ public static Expression convert(Cast cast) {
             while (child instanceof Alias) {
                 child = ((Alias) child).child();
             }
-            if (child instanceof StateCombinator) {
+            if (child instanceof StateCombinator || child instanceof 
CombineCombinator) {

Review Comment:
   Fixed in ccbda7c233d with the minimal path suggested here: 
`CombineCombinator` is no longer rewritten by `ConvertAggStateCast`; 
incompatible casts are left to `CheckCast` and produce `AnalysisException`. 
Added the mismatched-arity `topn_combine` negative test.



-- 
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]

Reply via email to