GitHub user viirya opened a pull request: https://github.com/apache/spark/pull/18141
[SPARK-20916][SQL] Improve error message for unaliased subqueries in FROM clause ## What changes were proposed in this pull request? We changed the parser to reject unaliased subqueries in the FROM clause in SPARK-20690. However, the error message that we now give isn't very helpful: scala> sql("""SELECT x FROM (SELECT 1 AS x)""") org.apache.spark.sql.catalyst.parser.ParseException: mismatched input 'FROM' expecting {<EOF>, 'WHERE', 'GROUP', 'ORDER', 'HAVING', 'LIMIT', 'LATERAL', 'WINDOW', 'UNION', 'EXCEPT', 'MINUS', 'INTERSECT', 'SORT', 'CLUSTER', 'DISTRIBUTE'}(line 1, pos 9) We should modify the parser to throw a more clear error for such queries: scala> sql("""SELECT x FROM (SELECT 1 AS x)""") org.apache.spark.sql.catalyst.parser.ParseException: The unaliased subqueries in the FROM clause are not supported.(line 1, pos 14) ## How was this patch tested? Modified existing tests to reflect this change. You can merge this pull request into a Git repository by running: $ git pull https://github.com/viirya/spark-1 SPARK-20916 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/18141.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #18141 ---- commit 0a7eab0e456ffc0113ec9d39618617b970922f9b Author: Liang-Chi Hsieh <vii...@gmail.com> Date: 2017-05-30T03:52:47Z Improve error message for unaliased subqueries in FROM clause. ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org