dilipbiswal commented on a change in pull request #24150: [SPARK-27209][SQL] 
Split parsing of SELECT and INSERT into two top-level rules in the grammar file.
URL: https://github.com/apache/spark/pull/24150#discussion_r267531919
 
 

 ##########
 File path: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/parser/PlanParserSuite.scala
 ##########
 @@ -754,4 +754,29 @@ class PlanParserSuite extends AnalysisTest {
       assertEqual(query2, Distinct(a.union(b)).except(c.intersect(d, isAll = 
true), isAll = true))
     }
   }
+
+  test("create/alter view as insert into table") {
+    intercept[ParseException](parsePlan("CREATE VIEW testView AS INSERT INTO 
jt VALUES(1, 1)"))
 
 Review comment:
   @dongjoon-hyun Let me paste a sample error from the describe query test.
   ```
   DESCRIBE
      FROM desc_temp1 a
        insert into desc_temp1 select *
        insert into desc_temp2 select *
   -- !query 13 schema
   struct<>
   -- !query 13 output
   org.apache.spark.sql.catalyst.parser.ParseException
   
   mismatched input 'insert' expecting {<EOF>, '(', ',', 'ANTI', 'CLUSTER', 
'CROSS', 'DISTRIBUTE', 'EXCEPT', 'FULL', 'GROUP', 'HAVING', 'INNER', 
'INTERSECT', 'JOIN', 'LATERAL', 'LEFT', 'LIMIT', 'NATURAL', 'ORDER', 'PIVOT', 
'RIGHT', 'SELECT', 'SEMI', 'MINUS', 'SORT', 'UNION', 'WHERE', 'WINDOW'}(line 3, 
pos 5)
   
   ````
   I am thinking, this is coming from antlr itself as it knows the expected 
grammar ?

----------------------------------------------------------------
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]

Reply via email to