cloud-fan commented on code in PR #53664:
URL: https://github.com/apache/spark/pull/53664#discussion_r2721354689
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/optimizer/finishAnalysis.scala:
##########
@@ -80,19 +80,55 @@ object RewriteNonCorrelatedExists extends Rule[LogicalPlan]
{
* Computes expressions in inline tables. This rule is supposed to be called
at the very end
* of the analysis phase, given that all the expressions need to be fully
resolved/replaced
* at this point.
+ *
+ * Note: Inline tables with outer references (correlated) are NOT evaluated
here - they will
+ * be rewritten by RewriteCorrelatedInlineTable and handled by the
decorrelation framework.
+ * If spark.sql.legacy.valuesGeneralizedExpressionsEnabled is false, we'll
never see such
+ * tables here (they're rejected during analysis).
*/
object EvalInlineTables extends Rule[LogicalPlan] with CastSupport {
override def apply(plan: LogicalPlan): LogicalPlan = {
plan.transformDownWithSubqueriesAndPruning(_.containsPattern(INLINE_TABLE_EVAL))
{
- case table: ResolvedInlineTable => eval(table)
+ case table: ResolvedInlineTable =>
+ // Check if table has outer references (correlated expressions)
+ // Note: If config is disabled, we never reach here with outer refs
+ val hasOuterRefs =
table.rows.flatten.exists(SubExprUtils.containsOuter)
+ if (hasOuterRefs) {
Review Comment:
why this is not consistent with
https://github.com/apache/spark/pull/53664/files#diff-7e4ddee59d212bc87f2688a7df5c4cba57b2a14a46344988ffd61dfda4baa36eR62
?
--
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]