Repository navigation
Keep the properties dict passed to create_table unchanged - #4456
Open
rahulsmahadev wants to merge 1 commit into
Open
rahulsmahadev wants to merge 1 commit into
rahulsmahadev wants to merge 1 commit into
Conversation
new_table_metadata popped format-version from the caller's properties dict, so reusing one dict gave the requested version only to the first table. Pop from a copy, and make the Glue and DynamoDB create paths, which relied on the pop, write the new metadata's properties instead. Co-authored-by: Isaac <no-reply@databricks.com>
Contributor
Author
|
@rambleraptor, you reviewed #4133, which pruned removed table properties from Glue parameters. @Ankitraj-builds, you wrote it. Could you take a look when you have a chance? Thanks! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale for this change
Bug:
new_table_metadatareads the requested format version withproperties.pop("format-version", ...)on the dict passed tocreate_table, so the caller's dict loses the key. For example, reusing a v1 properties dict with the SQL catalog creates the second table as v2:create_table_transactionremoves the key before the commit, andcreate_table_if_not_existsalso removes it when the table exists. The pop is from #411, to keepformat-versionout of the persisted table properties.Fix: pop from a copy. The Glue and DynamoDB
create_tablewrote the caller's dict to the Glue parameters and the DynamoDB item after this call, so they relied on the pop; they now write the new metadata's properties, as Glue'scommit_tabledoes. That also turns the values into strings there: Glue storesTrueastrue, and DynamoDB accepts non-string values instead of failing withParamValidationError.Java: the
BaseMetastoreCatalogtable builder copies the properties into its own map, andTableMetadata.newTableMetadatareads the version withPropertyUtil.propertyAsIntand persists a new filtered map, so the caller's map is never changed.persistedPropertiesleaves out all reserved properties (uuid,snapshot-count, ...);new_table_metadatastill only leaves outformat-version.Are these changes tested?
Yes,
test_create_v1_tables_with_shared_propertiesintests/catalog/test_catalog_behaviors.py,test_new_table_metadata_does_not_change_propertiesintests/table/test_metadata.pyandtest_create_v1_tableintests/catalog/test_dynamodb.pyfail on main (the dict losesformat-version, or the versions are[1, 2, 2]) and pass with this change.test_create_v1_tableandtest_create_table_s3tablesintests/catalog/test_glue.pynow check the exact Glue parameters.Are there any user-facing changes?
Yes,
create_tableno longer changes the passedpropertiesdict, and the Glue and DynamoDB catalogs write the property values as strings when creating a table.Please add the
changeloglabel.This pull request and its description were written by Isaac.