Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-42552

Get ParseException when run sql: "SELECT 1 UNION SELECT 1;"

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.2.3
    • 3.5.0
    • SQL
    • None
    • Scala version 2.12.15 (OpenJDK 64-Bit Server VM, Java 1.8.0_345)
      Spark version 3.2.3-SNAPSHOT

    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

       

       

      Attachments

        Activity

          People

            chengpan Cheng Pan
            jiang13021 jiang13021
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: