Bruce Robbins created SPARK-59350:
-------------------------------------

             Summary: Outer attribute cannot be used in nested subquery
                 Key: SPARK-59350
                 URL: https://issues.apache.org/jira/browse/SPARK-59350
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 4.0.1
            Reporter: Bruce Robbins


In Spark, the following query returns an error:
{noformat}
select *
from (values (1, 1), (2, 2), (3, 1)) as t1(a, b)
where exists (
  select c1
  from (values (1), (8)) as t2(c1)
  where a = c1
  or exists (select col1 from (values (3), (9)) as t3(col1) where a = col1)
);

[UNRESOLVED_COLUMN.WITH_SUGGESTION] A column, variable, or function parameter 
with name `a` cannot be resolved. Did you mean one of the following? [`col1`]. 
SQLSTATE: 42703; line 7 pos 66;
{noformat}
In Postgresql and DuckDB, the query returns the following results:
{noformat}
 a | b 
---+---
 1 | 1
 3 | 1
(2 rows)
{noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to