Details
Description
When I run sql
scala> spark.sql("SELECT 1 UNION SELECT 1;")
I get ParseException:
org.apache.spark.sql.catalyst.parser.ParseException: mismatched input 'SELECT' expecting {<EOF>, ';'}(line 1, pos 15)== SQL == SELECT 1 UNION SELECT 1; ---------------^^^ at org.apache.spark.sql.catalyst.parser.ParseException.withCommand(ParseDriver.scala:266) at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parse(ParseDriver.scala:127) at org.apache.spark.sql.execution.SparkSqlParser.parse(SparkSqlParser.scala:51) at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parsePlan(ParseDriver.scala:77) at org.apache.spark.sql.SparkSession.$anonfun$sql$2(SparkSession.scala:616) at org.apache.spark.sql.catalyst.QueryPlanningTracker.measurePhase(QueryPlanningTracker.scala:111) at org.apache.spark.sql.SparkSession.$anonfun$sql$1(SparkSession.scala:616) at org.apache.spark.sql.SparkSession.withActive(SparkSession.scala:775) at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:613) ... 47 elided
If I run with parentheses , it works well
scala> spark.sql("(SELECT 1) UNION (SELECT 1);") res4: org.apache.spark.sql.DataFrame = [1: int]
This should be a bug