Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20133#discussion_r159364557
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala ---
    @@ -383,23 +383,34 @@ class SparkSqlAstBuilder(conf: SQLConf) extends 
AstBuilder(conf) {
        * {{{
        *   CREATE [TEMPORARY] TABLE [IF NOT EXISTS] [db_name.]table_name
        *   USING table_provider
    -   *   [OPTIONS table_property_list]
    -   *   [PARTITIONED BY (col_name, col_name, ...)]
    -   *   [CLUSTERED BY (col_name, col_name, ...)
    -   *    [SORTED BY (col_name [ASC|DESC], ...)]
    -   *    INTO num_buckets BUCKETS
    -   *   ]
    -   *   [LOCATION path]
    -   *   [COMMENT table_comment]
    -   *   [TBLPROPERTIES (property_name=property_value, ...)]
    +   *   create_table_clauses
        *   [[AS] select_statement];
    +   *
    +   *   create_table_clauses (order insensitive):
    +   *     [OPTIONS table_property_list]
    +   *     [PARTITIONED BY (col_name, col_name, ...)]
    +   *     [CLUSTERED BY (col_name, col_name, ...)
    +   *       [SORTED BY (col_name [ASC|DESC], ...)]
    +   *       INTO num_buckets BUCKETS
    +   *     ]
    +   *     [LOCATION path]
    +   *     [COMMENT table_comment]
    +   *     [TBLPROPERTIES (property_name=property_value, ...)]
        * }}}
        */
       override def visitCreateTable(ctx: CreateTableContext): LogicalPlan = 
withOrigin(ctx) {
         val (table, temp, ifNotExists, external) = 
visitCreateTableHeader(ctx.createTableHeader)
         if (external) {
           operationNotAllowed("CREATE EXTERNAL TABLE ... USING", ctx)
         }
    +
    +    checkDuplicateClauses(ctx.TBLPROPERTIES, "TBLPROPERTIES", ctx)
    +    checkDuplicateClauses(ctx.OPTIONS, "OPTIONS", ctx)
    +    checkDuplicateClauses(ctx.PARTITIONED, "PARTITIONED BY", ctx)
    +    checkDuplicateClauses(ctx.COMMENT, "COMMENT", ctx)
    +    checkDuplicateClauses(ctx.bucketSpec(), "CLUSTERED BY", ctx)
    +    checkDuplicateClauses(ctx.locationSpec, "LOCATION", ctx)
    --- End diff --
    
    nit `ctx.LOCATION`?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to