Github user krisgeus commented on a diff in the pull request:
https://github.com/apache/spark/pull/21893#discussion_r205988600
--- 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)
--- End diff --
Improved the exception message. Although I think it can not be reached due
to extensive sql syntax checks that occur before reaching here.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]