You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Pavle Martinović (Jira)" <ji...@apache.org> on 2025/05/26 13:41:00 UTC
[jira] [Created] (SPARK-52311) Fix bug with multiple self-references with UnresolvedSubqueryA in rCTEs
Pavle Martinović created SPARK-52311:
----------------------------------------
Summary: Fix bug with multiple self-references with UnresolvedSubqueryA 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ć
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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org