jackwener commented on code in PR #10954:
URL: https://github.com/apache/datafusion/pull/10954#discussion_r1643656995


##########
datafusion/sqllogictest/test_files/cte.slt:
##########
@@ -834,4 +834,28 @@ SELECT * FROM non_recursive_cte, recursive_cte;
 query I
 WITH t AS (SELECT * FROM t where t.a < 2) SELECT * FROM t
 ----
-1
\ No newline at end of file
+1
+
+# Issue: https://github.com/apache/datafusion/issues/10914
+# The CTE defined within the subquery is only visible inside that subquery.
+query I rowsort
+(WITH t AS (SELECT 400) SELECT * FROM t) UNION (SELECT * FROM t);
+----
+1
+2
+3
+400
+
+query error DataFusion error: Error during planning: table 
'datafusion\.public\.cte' not found
+(WITH cte AS (SELECT 400) SELECT * FROM cte) UNION (SELECT * FROM cte);

Review Comment:
   👍



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to