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

Make optional clauses order insensitive for CREATE DATABASE/VIEW SQL statement

    XMLWordPrintableJSON

    Details

    • Type: Sub-task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.3
    • Fix Version/s: 3.0.0
    • Component/s: SQL
    • Labels:
      None

      Description

      Each time, when I write a complex CREATE DATABASE/VIEW statements, I have to open the .g4 file to find the EXACT order of clauses in CREATE TABLE statement. When the order is not right, I will get A strange confusing error message generated from ANTLR4.

      The original g4 grammar for CREATE VIEW is

      CREATE [OR REPLACE] [[GLOBAL] TEMPORARY] VIEW [db_name.]view_name
        [(col_name1 [COMMENT col_comment1], ...)]
        [COMMENT table_comment]
        [TBLPROPERTIES (key1=val1, key2=val2, ...)]
      AS select_statement
      

      The proposal is to make the following clauses order insensitive.

        [COMMENT table_comment]
        [TBLPROPERTIES (key1=val1, key2=val2, ...)]
      


      The original g4 grammar for CREATE DATABASE is

      CREATE (DATABASE|SCHEMA) [IF NOT EXISTS] db_name
        [COMMENT comment_text]
        [LOCATION path]
        [WITH DBPROPERTIES (key1=val1, key2=val2, ...)]
      

      The proposal is to make the following clauses order insensitive.

        [COMMENT comment_text]
        [LOCATION path]
        [WITH DBPROPERTIES (key1=val1, key2=val2, ...)]
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                manifoldQAQ Yesheng Ma
                Reporter:
                manifoldQAQ Yesheng Ma
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: