dtenedor commented on code in PR #47447:
URL: https://github.com/apache/spark/pull/47447#discussion_r1715797314
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala:
##########
@@ -391,6 +391,17 @@ trait CheckAnalysis extends PredicateHelper with
LookupCatalog with QueryErrorsB
case _ =>
})
+
+ // Check for unresolved TABLE arguments after the main check above to
allow other analysis
+ // errors to apply first, providing better error messages.
+ getAllExpressions(operator).foreach(_.foreachUp {
Review Comment:
No, because we need to check all the expressions for "unresolved attribute"
or other errors first, before we do this check for
`FunctionTableSubqueryArgumentExpression` instances.
That code on L290 starts with this:
```
getAllExpressions(operator).foreach(_.foreachUp {
case a: Attribute if !a.resolved =>
failUnresolvedAttribute(operator, a, "UNRESOLVED_COLUMN")
...
```
We need to make sure we perform that "unresolved attribute" check for *all*
expressions in the plan *before* we proceed further to check for
`FunctionTableSubqueryArgumentExpression`.
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala:
##########
@@ -1058,9 +1069,7 @@ trait CheckAnalysis extends PredicateHelper with
LookupCatalog with QueryErrorsB
checkCorrelationsInSubquery(expr.plan, isLateral = true)
case _: FunctionTableSubqueryArgumentExpression =>
- expr.failAnalysis(
- errorClass =
"UNSUPPORTED_SUBQUERY_EXPRESSION_CATEGORY.UNSUPPORTED_TABLE_ARGUMENT",
- messageParameters = Map("treeNode" -> planToString(plan)))
+ // Do nothing here, since we will check for this pattern later.
Review Comment:
I originally tried this, but found that we encountered a `MatchError` here
in the presence of the `FunctionTableSubqueryArgumentExpression`. Therefore I
had to add this "do nothing" case back here, to allow the new code on L395-403
to check for this pattern separately later.
--
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]