Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-26613][SQL] Add another rename table grammar for spark sql #23535

Closed
wants to merge 1 commit into from
Closed

[SPARK-26613][SQL] Add another rename table grammar for spark sql #23535

wants to merge 1 commit into from

Conversation

beliefer
Copy link
Contributor

What changes were proposed in this pull request?

The current version of spark sql contains a rename grammar,like:

alter table nameA rename to nameB or alter view nameA rename to nameB.

Many database(e.g. mysql,oracle.) provide another grammar,like:

rename table nameA to nameB.

I thought maybe spark sql could consider the compatibility.

How was this patch tested?

This pr have a test case as follows:
sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLParserSuite.scala
sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala
sql/core/src/test/scala/org/apache/spark/sql/sources/PathOptionSuite.scala
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

@srowen
Copy link
Member

srowen commented Jan 14, 2019

Is it standard SQL or something Hive does? otherwise I don't think we'd generally add it.

@@ -105,6 +105,7 @@ statement
ADD COLUMNS '(' columns=colTypeList ')' #addTableColumns
| ALTER (TABLE | VIEW) from=tableIdentifier
RENAME TO to=tableIdentifier #renameTable
| RENAME (TABLE | VIEW) from=tableIdentifier TO to=tableIdentifier #renameTable
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution! I know, MySQL has both this syntax support and ALTER TABLE ... RENAME...

In the current stage, we are not randomly adding more syntax to Spark SQL for avoiding extra complexity. In the future, we might support different dialects.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot!

@gatorsmile gatorsmile closed this Jan 14, 2019
@beliefer
Copy link
Contributor Author

Is it standard SQL or something Hive does? otherwise I don't think we'd generally add it.
Thanks a lot! Spark SQL only standard SQL or Hive SQL supported now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants