-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-18146] [SQL] Avoid using Union to chain together create table and repair partition commands #15665
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-18146] [SQL] Avoid using Union to chain together create table and repair partition commands #15665
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -254,7 +254,8 @@ final class DataFrameWriter[T] private[sql](ds: Dataset[T]) { | |
| ) | ||
| } | ||
|
|
||
| df.sparkSession.sessionState.executePlan( | ||
| df.sparkSession.sessionState. | ||
| ( | ||
| InsertIntoTable( | ||
| table = UnresolvedRelation(tableIdent), | ||
| partition = Map.empty[String, Option[String]], | ||
|
|
@@ -388,16 +389,15 @@ final class DataFrameWriter[T] private[sql](ds: Dataset[T]) { | |
| partitionColumnNames = partitioningColumns.getOrElse(Nil), | ||
| bucketSpec = getBucketSpec | ||
| ) | ||
| val createCmd = CreateTable(tableDesc, mode, Some(df.logicalPlan)) | ||
| val cmd = if (tableDesc.partitionColumnNames.nonEmpty && | ||
| val result = df.sparkSession.sessionState.executePlan( | ||
| CreateTable(tableDesc, mode, Some(df.logicalPlan))) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is the execution of this command triggered at here?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like you want to call
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yea, we don't need the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed |
||
| if (tableDesc.partitionColumnNames.nonEmpty && | ||
| df.sparkSession.sqlContext.conf.manageFilesourcePartitions) { | ||
| // Need to recover partitions into the metastore so our saved data is visible. | ||
| val recoverPartitionCmd = AlterTableRecoverPartitionsCommand(tableDesc.identifier) | ||
| Union(createCmd, recoverPartitionCmd) | ||
| } else { | ||
| createCmd | ||
| //df.sparkSession.sessionState.executePlan( | ||
| // AlterTableRecoverPartitionsCommand(tableDesc.identifier)) | ||
| } | ||
| df.sparkSession.sessionState.executePlan(cmd).toRdd | ||
| result.toRdd | ||
| } | ||
| } | ||
|
|
||
|
|
||
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.
what's going on here? a dot ?
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.
Some github text editing gone wrong... fixed it