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


##########
fe/fe-core/src/main/java/org/apache/doris/nereids/rules/analysis/SubExprAnalyzer.java:
##########
@@ -234,8 +237,16 @@ private AnalyzedResult analyzeSubquery(SubqueryExpr expr) {
                 getScope().getSlots(), getScope().getAsteriskSlots());
         subqueryContext.setOuterScope(subqueryScope);
         subqueryContext.newAnalyzer().analyze();
-        return new AnalyzedResult((LogicalPlan) 
subqueryContext.getRewritePlan(),

Review Comment:
   This marks every CTE anchor found inside a subquery as `mustInline`, which 
bypasses the existing materialization guard in `CTEInline`: CTEs with multiple 
consumers or nondeterministic functions are normally kept as anchors when 
`enableCTEMaterialize` is on. For example, a subquery like `EXISTS (WITH picked 
AS (SELECT uuid() AS u) SELECT 1 FROM picked p1 JOIN picked p2 ON p1.u = p2.u 
WHERE outer_t.k = 1)` should evaluate the CTE once so the two consumers see the 
same `uuid()`, but after this mark both consumers are deep-copied/inlined and 
evaluate `uuid()` independently, changing the result. Please avoid forcing 
inline for CTEs that the normal `CTEInline` semantics must materialize, or 
restrict the force-inline path to cases that are proven safe.



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