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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/expressions/functions/ExpressionTrait.java:
##########
@@ -46,23 +47,58 @@ default void checkLegalityBeforeTypeCoercion() {}
     @Developing
     default void checkLegalityAfterRewrite() {}
 
+    /**
+     * getArguments.
+     */
     default List<Expression> getArguments() {
-        return children();

Review Comment:
   Unwrapping `Variable.realExpression` here only fixes callers that already go 
through `getArgument*()` / `getArguments*()`. The analyzer still binds 
functions before the later `VariableToLiteral` pass (`Analyzer` runs 
`BindExpression` first), and there are still reachable bind-time checks that 
inspect raw `child()` nodes for literal-ness. A concrete example at current 
head is `SET @p = 3; SELECT utc_timestamp(@p)`: `visitUnboundVariable()` 
returns `Variable(realExpression=literal)`, `visitUnboundFunction()` 
immediately calls `TypeCoercionUtils.processBoundFunction()`, and 
`UtcTimestamp.checkLegalityAfterRewrite()` still rejects 
`!child(0).isLiteral()`. So this patch fixes helper-based paths like 
`window_funnel`, but not the general Variable->literal timing problem described 
in the PR.



##########
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectContext.java:
##########
@@ -587,10 +589,23 @@ public void setUserVar(String name, LiteralExpr value) {
             LiteralExpr literalExpr = userVars.get(varName);
             if (literalExpr instanceof BoolLiteral) {
                 return Literal.of(((BoolLiteral) literalExpr).getValue());
-            } else if (literalExpr instanceof IntLiteral) {
+            } else if (literalExpr instanceof IntLiteral || literalExpr 
instanceof LargeIntLiteral) {
                 // the value in the IntLiteral should be int, but now is long 
in old planner literalExpr
                 // so type coercion to generate right new planner int Literal

Review Comment:
   This still leaves the forwarded-FE path inconsistent. 
`getLiteralForUserVar()` now relies on the stored legacy literal preserving its 
original primitive subtype, but `FEOpExecutor.getForwardUserVariables()` 
serializes user vars through `ExprToThriftVisitor.treeToThrift()`, and 
`ConnectProcessor.getLiteralExprFromThrift()` still reconstructs every 
`INT_LITERAL` as `new IntLiteral(node.int_literal.value)` while ignoring 
`node.type`. So a query forwarded through an observer/follower can still turn 
`CAST(1 AS BIGINT)` or a typed `SMALLINT`/`TINYINT` user var back into the 
narrowest inferred legacy `IntLiteral` before this switch runs, which 
reintroduces the original bug on that path. Please preserve `node.type` when 
rebuilding forwarded integer literals.



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