Peter Toth created SPARK-28297:
----------------------------------
Summary: Handling outer links in CTE subquery expressions
Key: SPARK-28297
URL: https://issues.apache.org/jira/browse/SPARK-28297
Project: Spark
Issue Type: Sub-task
Components: SQL
Affects Versions: 3.0.0
Reporter: Peter Toth
This query does work in Spark SQL:
{noformat}
select (with cte(x) as (select 1) select x from cte) from test10
{noformat}
But the following query can't handle the outer reference to the {{c}} column of
{{test10}} table:
{noformat}
scala> sql("select (with cte(x) as (select c) select x from cte) from
test10").show
org.apache.spark.sql.AnalysisException: Expressions referencing the outer query
are not supported outside of WHERE/HAVING clauses:
Project [outer(c#41)]
+- OneRowRelation
;;
Project [scalar-subquery#167 [] AS scalarsubquery()#169]
: +- Project [x#168]
: +- SubqueryAlias `cte`
: +- Project [c#41 AS x#168]
: +- Project [outer(c#41)]
: +- OneRowRelation
+- SubqueryAlias `default`.`test10`
+- Relation[c#41] parquet
{noformat}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]