Skip to content

Conversation

@lianhuiwang
Copy link
Contributor

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.

@SparkQA
Copy link

SparkQA commented May 18, 2016

Test build #2991 has finished for PR 13170 at commit af1d230.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented May 18, 2016

Test build #58772 has finished for PR 13170 at commit af1d230.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@rxin
Copy link
Contributor

rxin commented May 18, 2016

cc @hvanhovell for review.

* }}}
*/
override def visitTruncateTable(ctx: TruncateTableContext): LogicalPlan = withOrigin(ctx) {
val columnNamesOpt = Option(ctx.identifierList).map(visitIdentifierList)
Copy link
Contributor

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.

@hvanhovell
Copy link
Contributor

@lianhuiwang this looks pretty good. What is your take on the atomicity of the truncate operation?

@lianhuiwang
Copy link
Contributor Author

lianhuiwang commented May 19, 2016

@hvanhovell Thanks. I have address your comments.
It is not transactional in Hive semantics. we can see: https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java#L4218

@SparkQA
Copy link

SparkQA commented May 19, 2016

Test build #58833 has finished for PR 13170 at commit 8470a8a.

  • This patch fails MiMa tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

locations.foreach { location =>
if (location.isDefined) {
val path = new Path(location.get)
try {
Copy link
Member

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, Thanks.

@SparkQA
Copy link

SparkQA commented May 19, 2016

Test build #58853 has finished for PR 13170 at commit 1d3add1.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.


override def run(sparkSession: SparkSession): Seq[Row] = {
val catalog = sparkSession.sessionState.catalog
if (!catalog.tableExists(tableName)) {
Copy link
Contributor

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.

@lianhuiwang
Copy link
Contributor Author

lianhuiwang commented May 20, 2016

@hvanhovell Thanks. I have addressed your comments.

@SparkQA
Copy link

SparkQA commented May 20, 2016

Test build #58935 has finished for PR 13170 at commit 10377ba.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@hvanhovell
Copy link
Contributor

LGTM

@rxin
Copy link
Contributor

rxin commented May 20, 2016

Merging in master/2.0.

asfgit pushed a commit that referenced this pull request May 20, 2016
## 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]>
@asfgit asfgit closed this in 09a0051 May 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants