[ 
https://issues.apache.org/jira/browse/SPARK-52311?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Wenchen Fan resolved SPARK-52311.
---------------------------------
    Fix Version/s: 4.1.0
       Resolution: Fixed

Issue resolved by pull request 51041
[https://github.com/apache/spark/pull/51041]

> Fix bug with multiple self-references with UnresolvedSubqueries in rCTEs
> ------------------------------------------------------------------------
>
>                 Key: SPARK-52311
>                 URL: https://issues.apache.org/jira/browse/SPARK-52311
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 4.1.0
>            Reporter: Pavle Martinović
>            Assignee: Pavle Martinović
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 4.1.0
>
>
> Currently rCTEs don't behave properly in case when the anchor references the 
> same column multiple times in the anchor, leading to wrong things being 
> identified in the recursion.
> For example this rCTE:
>  
> WITH RECURSIVE tmp(x) AS (
> values (1), (2), (3), (4), (5)
> ), rcte(x, y) AS (
> SELECT x, x FROM tmp WHERE x = 1
> UNION ALL
> SELECT x + 1, x FROM rcte WHERE x < 5
> )
> SELECT * FROM rcte;
>  
> Will return:
> 1 1
> 2 2
> 3 3
> 4 4
> 5 5
>  
> Instead of:
> 1 1
> 2 1
> 3 2
> 4 3
> 5 4
>  
> Due to a collision in the names found by the anchor. 



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

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to