morrySnow commented on code in PR #46003:
URL: https://github.com/apache/doris/pull/46003#discussion_r1897677072


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/trees/plans/commands/ExecuteCommand.java:
##########
@@ -70,14 +70,15 @@ public void run(ConnectContext ctx, StmtExecutor executor) 
throws Exception {
         LogicalPlanAdapter planAdapter = new 
LogicalPlanAdapter(prepareCommand.getLogicalPlan(), executor.getContext()
                 .getStatementContext());
         executor.setParsedStmt(planAdapter);
-        // If it's not a short circuit query or schema version is 
different(indicates schema changed),
-        // need to do reanalyze and plan
+        // If it's not a short circuit query or schema version is 
different(indicates schema changed) or
+        // has nondeterministic functions in statement, then need to do 
reanalyze and plan
         boolean isShortCircuit = 
executor.getContext().getStatementContext().isShortCircuitQuery();
         boolean hasShortCircuitContext = 
preparedStmtCtx.shortCircuitQueryContext.isPresent();
         boolean schemaVersionMismatch = hasShortCircuitContext
                     && 
preparedStmtCtx.shortCircuitQueryContext.get().tbl.getBaseSchemaVersion()
                     != 
preparedStmtCtx.shortCircuitQueryContext.get().schemaVersion;
-        boolean needAnalyze = !isShortCircuit || schemaVersionMismatch || 
!hasShortCircuitContext;
+        boolean needAnalyze = !isShortCircuit || schemaVersionMismatch || 
!hasShortCircuitContext
+                        || 
executor.getContext().getStatementContext().hasNondeterministicInPreparedStatement();

Review Comment:
   i got it. u save the statement context and reuse them between these execute 
command. it works



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