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


##########
fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java:
##########
@@ -229,7 +235,7 @@ public StmtExecutor(ConnectContext context, OriginStatement 
originStmt, boolean
         this.originStmt = originStmt;
         this.serializer = context.getMysqlChannel().getSerializer();
         this.isProxy = isProxy;

Review Comment:
   This only propagates a caller-supplied start time for the raw-SQL 
constructor. The parsed-statement constructor below still reuses the 
`StatementContext` that `LogicalPlanBuilder.visitMultiStatements()` created 
during parsing, while `ConnectProcessor.executeQuery()` parses the entire 
packet before executing each statement. If the first statement in a 
multi-statement packet runs for a while, a later `select now(6)` is folded and 
sent to BE using that parse-time `statementStartTime`, not the time when that 
later statement starts executing. Please reset or replace the parsed statement 
context timestamp in `StmtExecutor(ConnectContext, StatementBase, ...)` before 
planning/execution so every statement gets its own execution-start instant.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/expression/rules/FoldConstantRuleOnFE.java:
##########
@@ -547,6 +556,22 @@ public Expression visitTryCast(TryCast cast, 
ExpressionRewriteContext context) {
         }
     }
 
+    @Override
+    public Expression visitNow(Now now, ExpressionRewriteContext context) {
+        now = rewriteChildren(now, context);
+        Optional<Expression> checkedExpr = preProcess(now);
+        if (checkedExpr.isPresent()) {
+            return checkedExpr.get();
+        }

Review Comment:
   This is a distinct null-context path from the existing debug-skip comment. 
`FrontendConjunctsUtils.isFiltered()` intentionally calls 
`FoldConstantRuleOnFE.evaluate(rewrittenExpr, null)`; after the guard at 
`evaluate()` was made null-safe, a rewritten metadata predicate containing 
`now()` still reaches this new visitor and dereferences `context` here. The 
helper catches the exception and returns `false`, so frontend metadata 
filtering is disabled for those predicates. Please either leave `Now` unchanged 
when no rewrite context is available, or pass a statement context into the 
helper path before folding `now()`.



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