-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-14507] [SQL] EXTERNAL keyword in a CTAS statement is not allowed #13395
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
Conversation
|
Test build #59595 has finished for PR 13395 at commit
|
|
test this please |
|
Test build #59596 has finished for PR 13395 at commit
|
| case Some(q) => | ||
| // Hive does not allow to use a CTAS statement to create a partitioned table. | ||
| if (tableDesc.partitionColumnNames.nonEmpty) { | ||
| val errorMessage = "A Create Table As Select (CTAS) statement is not allowed to " + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: CREATE TABLE ... AS SELECT to be consistent with other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's OK to just leave this; CTAS is a pretty common term
|
Just realized you are working on all the restrictions of CTAS. Based on the official document of Hive, CTAS has three restrictions:
I have two test cases you can put in test("CTAS - PARTITIONED BY is not supported") {
assertUnsupported(
sql = "CREATE TABLE my_tab(a double, b double) PARTITIONED BY (a STRING) " +
"AS SELECT key, value FROM mytable1")
}
test("CTAS - Bucketing is not supported") {
assertUnsupported(
sql = "CREATE TABLE my_tab(a double, b double) " +
"CLUSTERED BY (a) SORTED BY (b) INTO 5 BUCKETS AS SELECT key, value FROM mytable1")
} |
|
@gatorsmile Thanks. For partitioned by, it is in #13386. For clustered by, seems we do have test case in HiveDDLCommandSuite. |
|
uh, I see. Thanks! |
|
chatted with @andrewor14 . Since https://github.com/apache/spark/pull/13386/files will fix the location handling when convertCTAS is true, probably it is not really needed to ban EXTERNAL keyword (also, hive's syntax support external for a regular create table command). |
What changes were proposed in this pull request?
This PR makes the parser to throw an exception if a hive style CTAS command has an external keyword. The main reason of this change is to make the syntax consistent with CREATE TABLE USING AS SELECT syntax (it does not allow EXTERNAL keyword).
Another options is to make
EXTERNALkeyword optional.How was this patch tested?
HiveDDLCommandSuite
NOTE: This PR is based on #13386, which needs to be merged first.