srielau commented on code in PR #49835:
URL: https://github.com/apache/spark/pull/49835#discussion_r1946624298


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AbstractSqlParser.scala:
##########
@@ -72,9 +72,9 @@ abstract class AbstractSqlParser extends AbstractParser with 
ParserInterface {
   /** Creates LogicalPlan for a given SQL string of query. */
   override def parseQuery(sqlText: String): LogicalPlan =
     parse(sqlText) { parser =>
-      val ctx = parser.query()
+      val ctx = parser.singleQuery()

Review Comment:
   Let me get this straight: So at a minimum this is a query which can be be 
parsed fully (to EOF), but ALSO in a truncated form. The parser first assumes 
an alias. But it fails because it doesn't find the EOF. So it parses the whole 
query. Then, when expanding a view (or similar codepath) is does not need to go 
to EAF so it takes the prefered (first choice) of teh truncated query.
   SELECT 1 WHERE 1=0, cannot parse successfully, but what about:
   CREATE VIEW v(c1) AS SELECT c1 FROM T GROUP BY c1;
   What's stopping the parser from declaring victory after the table name and 
ignoring the GROUP BY?
   
   Is this really a day-1 bug? Baffling.



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to