Skip to content

Commit e0ea336

Browse files
committed
wip: add failing test case
1 parent 61dc1a5 commit e0ea336

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

  • datafusion/sqllogictest/test_files

‎datafusion/sqllogictest/test_files/cte.slt‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,3 +211,29 @@ SELECT * FROM my_cte t1, my_cte
211211
6 5
212212
6 5
213213
6 6
214+
215+
# CTE within recursive CTE works and does not result in 'index out of bounds: the len is 0 but the index is 0'
216+
query
217+
WITH RECURSIVE "recursive_cte" AS (
218+
SELECT 1 as "val"
219+
UNION ALL (
220+
WITH "sub_cte" AS (
221+
SELECT
222+
time,
223+
1 as "val"
224+
FROM
225+
(SELECT DISTINCT "time" FROM "beg_account_balance")
226+
)
227+
SELECT
228+
2 as "val"
229+
FROM
230+
"recursive_cte"
231+
FULL JOIN "sub_cte" ON 1 = 1
232+
WHERE
233+
"recursive_cte"."val" < 2
234+
)
235+
)
236+
SELECT
237+
*
238+
FROM
239+
"recursive_cte";

0 commit comments

Comments
 (0)