maropu commented on a change in pull request #23531: [SPARK-24497][SQL] Support
recursive SQL query
URL: https://github.com/apache/spark/pull/23531#discussion_r307091967
##########
File path: sql/core/src/test/resources/sql-tests/results/cte.sql.out
##########
@@ -328,16 +328,891 @@ struct<scalarsubquery():int>
-- !query 25
-DROP VIEW IF EXISTS t
+WITH r(level) AS (
+ VALUES (0)
+ UNION ALL
+ SELECT level + 1 FROM r WHERE level < 10
+)
+SELECT * FROM r
-- !query 25 schema
struct<>
-- !query 25 output
-
+org.apache.spark.sql.AnalysisException
+Table or view not found: r; line 4 pos 24
Review comment:
Can you make the error message more clear as pg does so?
```
postgres=# WITH r(level) AS (
postgres(# VALUES (0)
postgres(# UNION ALL
postgres(# SELECT level + 1 FROM r WHERE level < 10
postgres(# )
postgres-# SELECT * FROM r;
ERROR: relation "r" does not exist
LINE 4: SELECT level + 1 FROM r WHERE level < 10
^
DETAIL: There is a WITH item named "r", but it cannot be referenced from
this part of the query.
HINT: Use WITH RECURSIVE, or re-order the WITH items to remove forward
references.
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]