Repository navigation
Fix dynamic_partition_overwrite when PartitionSpec contains VoidTransform fields - #4509
Open
zerafachris wants to merge 1 commit into
Open
zerafachris wants to merge 1 commit into
zerafachris wants to merge 1 commit into
Conversation
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.
Closes #4486
Rationale for this change
When a partition field is dropped from a v1 table (or a v2 table upgraded from v1),
PartitionSpec.fieldsretains aVoidTransformfield.Transaction.dynamic_partition_overwriteiterated over allspec.fields, which caused it to:ValueError: For now dynamic overwrite does not support a table with non-identity-transform field ...whenever anyVoidTransformfield was present.VoidTransformas partitioned rather than unpartitioned.data_file.partitionrecords to only the active non-void positions when building the delete filter (which matters especially when aVoidTransformfield precedes an activeIdentityTransformfield inspec.fields, sincedata_file.partitionis positionally indexed byspec.fields).This change filters
spec.fieldsto active non-void fields(pos, field), raises the unpartitionedValueErrorif none remain, validatesIdentityTransformonly on active fields, and projectsRecord(*(data_file.partition[pos] for pos, _ in non_void_fields))for the partition overwrite filter.Note: This addresses a distinct failure mode in
Transaction.dynamic_partition_overwritefrom #4204 (which resolves nested column paths in_build_partition_predicate).Are these changes tested?
Yes. Added unit tests in
tests/table/test_init.py:test_dynamic_partition_overwrite_with_void_partition_field(both v1 and upgraded-to-v2 tables)test_dynamic_partition_overwrite_with_leading_void_partition_field(verifies positional projection when aVoidTransformprecedes an active partition field)test_dynamic_partition_overwrite_all_void_partition_fields_raisesVerified locally:
pytest tests/table/ tests/catalog/test_catalog_behaviors.py -m unit: 1037 passedpytest tests/ -m unit --ignore=tests/integration --ignore=tests/avro/test_decoder.py --ignore=tests/avro/test_reader.py --ignore=tests/avro/test_resolver.py --ignore=tests/catalog/test_hive.py: 4721 passed, 6 skipped, 129 deselectedruff checkandruff format --checkon modified files: passedAre there any user-facing changes?
No.