-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-15335] [SQL] Implement TRUNCATE TABLE Command #13170
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 #2991 has finished for PR 13170 at commit
|
|
Test build #58772 has finished for PR 13170 at commit
|
|
cc @hvanhovell for review. |
| * }}} | ||
| */ | ||
| override def visitTruncateTable(ctx: TruncateTableContext): LogicalPlan = withOrigin(ctx) { | ||
| val columnNamesOpt = Option(ctx.identifierList).map(visitIdentifierList) |
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.
We could just check ctx.identifierList != null.
|
@lianhuiwang this looks pretty good. What is your take on the atomicity of the truncate operation? |
|
@hvanhovell Thanks. I have address your comments. |
|
Test build #58833 has finished for PR 13170 at commit
|
| locations.foreach { location => | ||
| if (location.isDefined) { | ||
| val path = new Path(location.get) | ||
| try { |
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.
Move newHadoopConf above this loop?
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.
yes, Thanks.
|
Test build #58853 has finished for PR 13170 at commit
|
|
|
||
| override def run(sparkSession: SparkSession): Seq[Row] = { | ||
| val catalog = sparkSession.sessionState.catalog | ||
| if (!catalog.tableExists(tableName)) { |
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.
Lets log errors instead of warnings.
|
@hvanhovell Thanks. I have addressed your comments. |
|
Test build #58935 has finished for PR 13170 at commit
|
|
LGTM |
|
Merging in master/2.0. |
## What changes were proposed in this pull request? Like TRUNCATE TABLE Command in Hive, TRUNCATE TABLE is also supported by Hive. See the link: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL Below is the related Hive JIRA: https://issues.apache.org/jira/browse/HIVE-446 This PR is to implement such a command for truncate table excluded column truncation(HIVE-4005). ## How was this patch tested? Added a test case. Author: Lianhui Wang <[email protected]> Closes #13170 from lianhuiwang/truncate. (cherry picked from commit 09a0051) Signed-off-by: Reynold Xin <[email protected]>
What changes were proposed in this pull request?
Like TRUNCATE TABLE Command in Hive, TRUNCATE TABLE is also supported by Hive. See the link: https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL
Below is the related Hive JIRA: https://issues.apache.org/jira/browse/HIVE-446
This PR is to implement such a command for truncate table excluded column truncation(HIVE-4005).
How was this patch tested?
Added a test case.