1 parent 61dc1a5 commit e0ea336Copy full SHA for e0ea336
1 file changed
datafusion/sqllogictest/test_files/cte.slt
@@ -211,3 +211,29 @@ SELECT * FROM my_cte t1, my_cte
211
6 5
212
213
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
228
+ 2 as "val"
229
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