[
https://issues.apache.org/jira/browse/SPARK-28297?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Peter Toth updated SPARK-28297:
-------------------------------
Description:
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}
select (with cte(x) as (select c) select x from cte) from test10
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}
was:
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}
select (with cte(x) as (select c) select x from cte) from test10
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}
> 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
> Priority: Major
>
> 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}
> select (with cte(x) as (select c) select x from cte) from test10
> 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]