AveryQi115 commented on code in PR #53664:
URL: https://github.com/apache/spark/pull/53664#discussion_r2796527683
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/InlineCTE.scala:
##########
@@ -60,9 +60,20 @@ case class InlineCTE(
// because:
// 1) It is fine to inline a CTE if it references another CTE that is
non-deterministic;
// 2) Any `CTERelationRef` that contains `OuterReference` would have been
inlined first.
+
+ def hasOuterReference(plan: LogicalPlan): Boolean = {
+ plan.exists {
+ case table: ResolvedInlineTable =>
+ // Check rows explicitly as they're not included in plan.expressions
+ table.rows.flatten.exists(_.isInstanceOf[OuterReference])
Review Comment:
We can also put the inlining constants in RewriteCorrelatedInlineTable.
--
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]