-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-36850][SQL] Migrate CreateTableStatement to v2 command framework #34060
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
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #143477 has finished for PR 34060 at commit
|
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.
This is only temporary and will be removed after CreateTableAsSelect, ReplaceTable and ReplaceTableAsSelect are migrated to v2 command framework.
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.
V2CreateTablePlan can't be deleted yet because it is also extended by CreateTableAsSelect, ReplaceTable and ReplaceTableAsSelect. I use V2CreateTablePlanX for this new trait for now.
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.
Do we have to add this? Can we let the new CreateTable extends V2CreateTablePlan and implement tableName?
def tableName = {
assert(name.isResolved)
name.asInstanceOf[ResolvedDBObjectName].nameParts.asIdentifier
}
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.
The original case create: V2CreateTablePlan will be removed and this will be changed to
case create: V2CreateTablePlan after the migration of CreateTableAsSelect, ReplaceTable and ReplaceTableAsSelect is done.
1965f77 to
9e42d67
Compare
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #143667 has finished for PR 34060 at commit
|
|
Test build #143889 has started for PR 34060 at commit |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
0af17cd to
e146c17
Compare
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #144280 has finished for PR 34060 at commit
|
|
Hi @huaxingao , any update? I am trying to migrate |
e146c17 to
6ffae91
Compare
|
@dchvn Sorry for the late reply. I will work on this now. |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
…rces/rules.scala Co-authored-by: Wenchen Fan <[email protected]>
97481b3 to
39320f4
Compare
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #145661 has finished for PR 34060 at commit
|
| redactMapString(map, maxFields) | ||
| case t: TableSpec => | ||
| redactMapString(t.options, maxFields) | ||
| redactMapString(t.properties, maxFields) |
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 we need to return a copy of TableSpec with options and properties redacted.
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.
Sorry I didn't get this right. Fixed.
| import org.apache.spark.sql.catalyst.expressions.objects.StaticInvoke | ||
| import org.apache.spark.sql.catalyst.parser.{CatalystSqlParser, ParseException} | ||
| import org.apache.spark.sql.catalyst.plans.logical.{AlterColumn, AnalysisOnlyCommand, AppendData, Assignment, CreateTableAsSelect, CreateTableStatement, CreateV2Table, DeleteAction, DeleteFromTable, DescribeRelation, DropTable, InsertAction, LocalRelation, LogicalPlan, MergeIntoTable, OneRowRelation, Project, SetTableLocation, SetTableProperties, ShowTableProperties, SubqueryAlias, UnsetTableProperties, UpdateAction, UpdateTable} | ||
| import org.apache.spark.sql.catalyst.plans.logical.{AlterColumn, AnalysisOnlyCommand, AppendData, Assignment, CreateTable => CatalystCreateTable, CreateTableAsSelect, DeleteAction, DeleteFromTable, DescribeRelation, DropTable, InsertAction, LocalRelation, LogicalPlan, MergeIntoTable, OneRowRelation, Project, SetTableLocation, SetTableProperties, ShowTableProperties, SubqueryAlias, UnsetTableProperties, UpdateAction, UpdateTable} |
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: can we change import org.apache.spark.sql.execution.datasources.CreateTable to import org.apache.spark.sql.execution.datasources.CreateTableV1 and keep the CreateTable here unchanged?
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.
Fixed
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #145733 has finished for PR 34060 at commit
|
|
thanks, merging to master! |
|
Thanks! |
| originalMultipartIdentifier, | ||
| df.schema.asNullable, | ||
| partitioningColumns.getOrElse(Nil).asTransforms.toSeq, | ||
| val tableProperties = TableSpec( |
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.
typo: this should be tableSpec
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.
Will have a follow up to fix this.
…ndition for CTAS and RTAS ### What changes were proposed in this pull request? fixed a few problems: 1. addressed this [comment](#34060 (comment)) 2. combined several `xxxOnlySupportedWithV2TableError` 3. in CTAS and RTAS, the `if isSessionCatalog(catalog)` should not be on the pattern, it should be `if (isSessionCatalog(catalog) && !isV2Provider(provider))`. Otherwise, `c.partitioning ++ c.tableSpec.bucketSpec.map(_.asTransform)` is not done for non SessionCatalog case. I tried this `c.partitioning ++ c.tableSpec.bucketSpec.map(_.asTransform)` inside `AstBuilder` but it failed [here]( https://github.com/apache/spark/blob/master/sql/core/src/test/scala/org/apache/spark/sql/execution/command/DDLSuite.scala#L850) so I kept this in `ResolveSessionCatalog` ### Why are the changes needed? code cleaning up and bug fixing ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Existing tests Closes #34857 from huaxingao/followup. Lead-authored-by: Huaxin Gao <[email protected]> Co-authored-by: Huaxin Gao <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
What changes were proposed in this pull request?
Migrate
CreateTableStatementto v2 command frameworkWhy are the changes needed?
Migrate to the standard V2 framework
Does this PR introduce any user-facing change?
no
How was this patch tested?
existing tests