Github user srinathshankar commented on the issue:
https://github.com/apache/spark/pull/15763
As it stands the check seems overly aggressive. The following works:
```sql
select t1.c1
from t1
where t1.c1 in (
select c1 + 1 as col
from t2
where t1.c2 < t2.c2)
```
```
scala> sql("select t1.c1 from t1 where t1.c1 in (select c1 + 1 as col from
t2 where t1.c2 < t2.c2)").show()
+---+
| c1|
+---+
+---+
```
But the following, when I wrap the subselect with a project, does not
```sql
select t1.c1
from t1
where t1.c1 in (
select col + 1
from (
select c1 as col
from t2
where t1.c2 < t2.c2))
```
```
scala> sql("select t1.c1 from t1 where t1.c1 in (select col + 1 from
(select c1 as col from t2 where t1.c2 < t2.c2))").show()
org.apache.spark.sql.AnalysisException: Correlated column is not allowed in
a non-equality predicate:
Project [(col#29 + 1) AS (col + 1)#32]
+- Project [(c1#16 + 1) AS col#29]
+- Filter (outer(c2#6) < c2#17)
+- SubqueryAlias t2
+- Project [_1#13 AS c1#16, _2#14 AS c2#17]
+- LocalRelation [_1#13, _2#14]
;
```
Is this intentional ?
---
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]