github-actions[bot] commented on code in PR #68488:
URL: https://github.com/apache/doris/pull/68488#discussion_r4104951060


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/combinator/StateCombinator.java:
##########
@@ -165,4 +167,12 @@ public void checkLegalityBeforeTypeCoercion() {
     public void checkLegalityAfterRewrite() {
         nested.withChildren(children()).checkLegalityAfterRewrite();
     }
+
+    @Override
+    public Expression rewriteWhenAnalyze() {
+        AggregateFunction coercedNested = nested.withChildren(children());

Review Comment:
   [P1] Preserve the analyzed AggState layout while forwarding this rewrite. 
ExpressionAnalyzer invokes this hook under 
MoreFieldsThread.keepFunctionSignature(false), so withChildren rebuilds the 
combinator without its origin signature and derives returnType from the 
rewritten children. For percentile_reservoir_state(v, CAST('0.25' AS DOUBLE)), 
checkLevel replaces the nullable cast with a non-null DoubleLiteral, changing 
the serialized subtype from DOUBLE NULL to DOUBLE NOT NULL; the existing 
state-layout preservation fix is meant to prevent unions/merges from returning 
NULL or accepting incompatible layouts. Keep the analyzed signature while 
replacing only the executed child (and apply the same fix to CombineCombinator).



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