-
Notifications
You must be signed in to change notification settings - Fork 28.7k
[SPARK-52683][SQL] Support ExternalCatalog alterTableSchema #51373
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
929adf2
to
29f253b
Compare
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/ExternalCatalog.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/InMemoryCatalog.scala
Show resolved
Hide resolved
@@ -309,7 +309,7 @@ class V2SessionCatalog(catalog: SessionCatalog) | |||
collation = collation, storage = storage)) | |||
} | |||
if (changes.exists(_.isInstanceOf[TableChange.ColumnChange])) { | |||
catalog.alterTableDataSchema(ident.asTableIdentifier, schema) | |||
catalog.alterTableSchema(ident.asTableIdentifier, schema) |
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.
ah, so the schema
here is already the full schema
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.
yea i noticed and had a pr to fix that #51372 but we can fix both if we do this one.
sql/core/src/main/scala/org/apache/spark/sql/execution/command/tables.scala
Outdated
Show resolved
Hide resolved
thanks, merging to master! |
### What changes were proposed in this pull request? Add a new ExternalCatalog and SessionCatalog API alterTableSchema that will supersede alterTableDataSchema. ### Why are the changes needed? Because ExternalCatalog::alterTableDataSchema takes dataSchema only (without partition columns), we lost the context of the partition column. This will make it impossible for us to support column order where partition column are not at the end. See apache#51342 for context More generally, this is a better intuitive API than alterTableDataSchema, because the caller no longer needs to strip out partition columns. Also, it is not immediately intuitive that data schema means without partition columns. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Existing test, move test for alterTableDataSchema to the new API ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#51373 from szehon-ho/alter_table_schema. Authored-by: Szehon Ho <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
### What changes were proposed in this pull request? Add a new ExternalCatalog and SessionCatalog API alterTableSchema that will supersede alterTableDataSchema. ### Why are the changes needed? Because ExternalCatalog::alterTableDataSchema takes dataSchema only (without partition columns), we lost the context of the partition column. This will make it impossible for us to support column order where partition column are not at the end. See apache#51342 for context More generally, this is a better intuitive API than alterTableDataSchema, because the caller no longer needs to strip out partition columns. Also, it is not immediately intuitive that data schema means without partition columns. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Existing test, move test for alterTableDataSchema to the new API ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#51373 from szehon-ho/alter_table_schema. Authored-by: Szehon Ho <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
What changes were proposed in this pull request?
Add a new ExternalCatalog and SessionCatalog API alterTableSchema that will supersede alterTableDataSchema.
Why are the changes needed?
Because ExternalCatalog::alterTableDataSchema takes dataSchema only (without partition columns), we lost the context of the partition column. This will make it impossible for us to support column order where partition column are not at the end.
See #51342 for context
More generally, this is a better intuitive API than alterTableDataSchema, because the caller no longer needs to strip out partition columns. Also, it is not immediately intuitive that data schema means without partition columns.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Existing test, move test for alterTableDataSchema to the new API
Was this patch authored or co-authored using generative AI tooling?
No