Github user hvanhovell commented on a diff in the pull request:
https://github.com/apache/spark/pull/16012#discussion_r89656204
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/Analyzer.scala
---
@@ -989,7 +989,7 @@ class Analyzer(
withPosition(u) {
try {
outer.resolve(nameParts, resolver) match {
- case Some(outerAttr) => OuterReference(outerAttr)
+ case Some(outerAttr) => OuterReference(outerAttr)()
--- End diff --
I am not sure the analyzer change has the desired effect. This just remove
the outer reference from the tree, and this won't work if we use the attribute
anywhere in the tree. For example:
```sql
select *
from tbl_a
where id in (select x
from (select tbl_b.id,
tbl_a.id + 1 as x,
tbl_a.id + tbl_b.id as y
from tbl_b)
where y > 0)
```
I think we need to break this down into two steps:
1. Do not support this for now and just fix the named expression. That
would be my goal for 2.1.
2. Try to see if we can rewrite the tree in such a way that we can extract
the value. That would be my goal for 2.2. I am not sure how well we can make
this work. In the end I think we need a dedicated subquery operator.
cc @nsyca what do you think.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]