Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-27901 Improve the error messages of SQL parser
  3. SPARK-24077

Issue a better error message for `CREATE TEMPORARY FUNCTION IF NOT EXISTS`

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Reopened
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.3.0
    • Fix Version/s: None
    • Component/s: SQL
    • Labels:

      Description

      The error message of CREATE TEMPORARY FUNCTION IF NOT EXISTS looks confusing:

      scala> org.apache.spark.sql.SparkSession.builder().enableHiveSupport.getOrCreate.sql("CREATE TEMPORARY FUNCTION IF NOT EXISTS yuzhouwan as 'org.apache.spark.sql.hive.udf.YuZhouWan'")
      
      org.apache.spark.sql.catalyst.parser.ParseException:
      mismatched input 'NOT' expecting \{'.', 'AS'}(line 1, pos 29)
      
      == SQL ==
       CREATE TEMPORARY FUNCTION IF NOT EXISTS yuzhouwan as 'org.apache.spark.sql.hive.udf.YuZhouWan'
       -----------------------------^^^
       at org.apache.spark.sql.catalyst.parser.ParseException.withCommand(ParseDriver.scala:197)
       at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parse(ParseDriver.scala:99)
       at org.apache.spark.sql.execution.SparkSqlParser.parse(SparkSqlParser.scala:45)
       at org.apache.spark.sql.catalyst.parser.AbstractSqlParser.parsePlan(ParseDriver.scala:53)
       at org.apache.spark.sql.SparkSession.sql(SparkSession.scala:592)
       ... 48 elided
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              benedict jin Benedict Jin
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: