Please sign in to comment.
[SPARK-29839][SQL] Supporting STORED AS in CREATE TABLE LIKE
### What changes were proposed in this pull request? In SPARK-29421 (#26097) , we can specify a different table provider for `CREATE TABLE LIKE` via `USING provider`. Hive support `STORED AS` new file format syntax: ```sql CREATE TABLE tbl(a int) STORED AS TEXTFILE; CREATE TABLE tbl2 LIKE tbl STORED AS PARQUET; ``` For Hive compatibility, we should also support `STORED AS` in `CREATE TABLE LIKE`. ### Why are the changes needed? See #26097 (comment) ### Does this PR introduce any user-facing change? Add a new syntax based on current CTL: CREATE TABLE tbl2 LIKE tbl [STORED AS hiveFormat]; ### How was this patch tested? Add UTs. Closes #26466 from LantaoJin/SPARK-29839. Authored-by: LantaoJin <email@example.com> Signed-off-by: Wenchen Fan <firstname.lastname@example.org>
- Loading branch information
Showing with 207 additions and 39 deletions.
- +1 −0 docs/sql-migration-guide.md
- +6 −1 sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
- +39 −4 sql/core/src/main/scala/org/apache/spark/sql/execution/SparkSqlParser.scala
- +31 −10 sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
- +30 −24 sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLParserSuite.scala
- +100 −0 sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala