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


##########
be/src/service/point_query_executor.cpp:
##########
@@ -151,11 +152,14 @@ Status Reusable::init(const TDescriptorTable& t_desc_tbl, 
const std::vector<TExp
         i->clear_names();
     }
 
-    RETURN_IF_ERROR(VExpr::create_expr_trees(output_exprs, 
_output_exprs_ctxs));
-    RowDescriptor row_desc(tuple_desc());
-    // Prepare the exprs to run.
-    RETURN_IF_ERROR(VExpr::prepare(_output_exprs_ctxs, _runtime_state.get(), 
row_desc));
-    RETURN_IF_ERROR(VExpr::open(_output_exprs_ctxs, _runtime_state.get()));
+    _output_exprs = output_exprs;
+    for (const auto& expr : _output_exprs) {
+        _output_exprs_require_runtime_state |=
+                std::any_of(expr.nodes.begin(), expr.nodes.end(), [](const 
TExprNode& node) {

Review Comment:
   [P1] Include runtime-dependent casts in this classifier
   
   This predicate treats every fn-less `CAST_EXPR`/`TRY_CAST_EXPR` tree as 
request-independent, but those nodes can still read `RuntimeState`. FE 
serializes `CastExpr` with the cast node type/opcode and no `fn`, while BE's 
TIMEV2-to-DATE/DATETIME casts read `timestamp_ms`, `nano_seconds`, and 
`timezone_obj` from their function context. Consequently, a prepared point 
query such as `SELECT CAST(CAST('01:02:03' AS TIME) AS DATETIME) FROM t WHERE 
k=?` with constant folding disabled leaves this flag false; a later cache hit 
takes the shared branch and can return the first execution's 
date/timezone-derived constant. Please classify CAST/TRY_CAST according to 
their BE runtime dependencies (or conservatively create an execution-local 
context) and cover two executions across different instants/timezones.



##########
fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java:
##########
@@ -2233,11 +2235,26 @@ public List<Pair<LogicalPlan, StatementContext>> 
visitMultiStatements(MultiState
                 connectContext.setStatementContext(statementContext);
                 statementContext.setConnectContext(connectContext);
             }
-            logicalPlans.add(Pair.of(
-                    ParserUtils.withOrigin(ctx, () -> (LogicalPlan) 
visit(statement)), statementContext));
-            List<Placeholder> params = new 
ArrayList<>(tokenPosToParameters.values());
-            statementContext.setPlaceholders(params);
-            tokenPosToParameters.clear();
+            try {
+                logicalPlans.add(Pair.of(
+                        ParserUtils.withOrigin(ctx, () -> (LogicalPlan) 
visit(statement)), statementContext));
+                List<Placeholder> params = new 
ArrayList<>(tokenPosToParameters.values());
+                statementContext.setPlaceholders(params);
+                tokenPosToParameters.clear();
+            } finally {
+                if (connectContext != null) {
+                    SessionVariable sessionVariable = 
connectContext.getSessionVariable();
+                    if (sessionVariable.getIsSingleSetVar()) {

Review Comment:
   [P1] Preserve caller-owned temporary scopes while parsing
   
   This cleanup also runs when `isSingleSetVar` was already active before the 
current statement parse. `StmtExecutor.generateHttpStreamPlan()` first sets 
`enable_strict_consistency_dml=false`, then `generateHttpStreamNereidsPlan()` 
calls `parseByNereids()`; even a hint-free INSERT reaches this block, which 
restores the default value and clears the caller's origin map before 
`insert.initPlan()`. `RequestPropertyDeriver` then sees strict consistency 
enabled and can reintroduce the sink shuffle that the HTTP stream path 
explicitly disables because it has one sink. Please restore only SET_VAR 
mutations owned by this parsed statement (preserving any pre-existing scope), 
and add an HTTP stream plan test that observes the value through 
physical-property derivation.



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