cloud-fan commented on code in PR #55950:
URL: https://github.com/apache/spark/pull/55950#discussion_r3310417657


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala:
##########
@@ -2824,6 +2824,10 @@ class Analyzer(
           j.copy(left = newLeft, right = newRight)
         }
 
+      // Allow scalar SQL UDFs in SQL table function inputs. They will be 
resolved
+      // when ResolveSQLTableFunctions expands the table function via 
executeSameContext.

Review Comment:
   Slight comment-accuracy nit: the inner `executeSameContext` call inside 
`ResolveSQLTableFunctions` runs with `SQLFunctionContext.nestedSQLFunctionDepth 
> 0`, which makes `ResolveSQLFunctions.apply` short-circuit (see L2846-2851). 
So the `SQLFunctionExpression` is **not** rewritten during that nested 
re-analysis. The actual rewrite happens later: once `ResolveSQLTableFunctions` 
has expanded the table function, the `SQLFunctionExpression` sits inside the 
expanded plan's input-cast `Project`, and a subsequent iteration of this same 
rule picks it up via the existing `Project` case at L2787.
   
   ```suggestion
         // Defer to a later iteration: once ResolveSQLTableFunctions expands 
the
         // table function, the SQLFunctionExpression sits inside the expanded
         // plan's input-cast Project and is rewritten by a subsequent iteration
         // of this rule.
   ```



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