Github user xuanyuanking commented on a diff in the pull request:

    https://github.com/apache/spark/pull/21893#discussion_r205945617
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala ---
    @@ -857,6 +857,32 @@ class SparkSqlAstBuilder(conf: SQLConf) extends 
AstBuilder(conf) {
           Option(ctx.partitionSpec).map(visitNonOptionalPartitionSpec))
       }
     
    +  /**
    +   * Create an [[AlterTableFormatPropertiesCommand]] command.
    +   *
    +   * For example:
    +   * {{{
    +   *   ALTER TABLE table [PARTITION spec] SET FILEFORMAT format;
    +   * }}}
    +   */
    +  override def visitSetTableFormat(ctx: SetTableFormatContext): 
LogicalPlan = withOrigin(ctx) {
    +    val format = (ctx.fileFormat) match {
    +      // Expected format: INPUTFORMAT input_format OUTPUTFORMAT 
output_format
    +      case (c: TableFileFormatContext) =>
    +        visitTableFileFormat(c)
    +      // Expected format: SEQUENCEFILE | TEXTFILE | RCFILE | ORC | PARQUET 
| AVRO
    +      case (c: GenericFileFormatContext) =>
    +        visitGenericFileFormat(c)
    +      case _ =>
    +        throw new ParseException("Expected STORED AS ", ctx)
    +    }
    +    AlterTableFormatCommand(
    +      visitTableIdentifier(ctx.tableIdentifier),
    +      format,
    +      // TODO a partition spec is allowed to have optional values. This is 
currently violated.
    +      Option(ctx.partitionSpec).map(visitNonOptionalPartitionSpec))
    --- End diff --
    
    Confused by this todo, as currently implementation, while partition spec is 
empty, we change table's catalog?


---

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

Reply via email to