dtenedor commented on code in PR #48091:
URL: https://github.com/apache/spark/pull/48091#discussion_r1766912430
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala:
##########
@@ -5854,7 +5854,20 @@ class AstBuilder extends DataTypeAstBuilder
windowClause = null,
relation = left,
isPipeOperatorSelect = true)
- }.get
+ }.getOrElse(Option(ctx.whereClause).map { c =>
+ // Add a table subquery boundary between the new filter and the input
plan if one does not
+ // already exist. This helps the analyzer behave as if we had added the
WHERE clause after a
+ // table subquery containing the input plan.
Review Comment:
We talked offline and found that updating the `UnresolvedRelation` pattern
match to this fixes the problem:
```
case u: UnresolvedRelation =>
u
```
In this way we don't add another redundant `SubqueryAlias` when
`ResolveRelations` will already add one. Looking at the
[commit](https://github.com/apache/spark/pull/48091/commits/0d32c2a23ac7e7f7a5e9f32a4bfb69a802c0bd6c)
that performs this update, we see the analyzer plans improve accordingly.
--
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]