Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-12362 Create a full-fledged built-in SQL parser
  3. SPARK-12772

Better error message for syntax error in the SQL parser

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0.0
    • 2.0.0
    • SQL
    • None

    Description

      scala> sql("select case if(true, 'one', 'two')").explain(true)
      org.apache.spark.sql.AnalysisException: org.antlr.runtime.EarlyExitException
      line 1:34 required (...)+ loop did not match anything at input '<EOF>' in case expression
      ; line 1 pos 34
      
      	at org.apache.spark.sql.catalyst.parser.ParseErrorReporter.throwError(ParseDriver.scala:140)
      	at org.apache.spark.sql.catalyst.parser.ParseErrorReporter.throwError(ParseDriver.scala:129)
      	at org.apache.spark.sql.catalyst.parser.ParseDriver$.parse(ParseDriver.scala:77)
      	at org.apache.spark.sql.catalyst.CatalystQl.createPlan(CatalystQl.scala:53)
      	at org.apache.spark.sql.hive.ExtendedHiveQlParser$$anonfun$hiveQl$1.apply(ExtendedHiveQlParser.scala:41)
      	at org.apache.spark.sql.hive.ExtendedHiveQlParser$$anonfun$hiveQl$1.apply(ExtendedHiveQlParser.scala:40)
      
      

      Is there a way to say something better other than "required (...)+ loop did not match anything at input"?

      Attachments

        Activity

          People

            hvanhovell Herman van Hövell
            rxin Reynold Xin
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: