fix: use kLegacyPartitionDataIdStart as partition field ID baseline#832
Open
WZhuo wants to merge 1 commit into
Open
fix: use kLegacyPartitionDataIdStart as partition field ID baseline#832WZhuo wants to merge 1 commit into
WZhuo wants to merge 1 commit into
Conversation
FreshPartitionSpec and TableMetadataBuilder::Impl both initialized the partition field ID counter to kInvalidPartitionFieldId (-1), causing the first partition field to get ID 0 instead of 1000. Partition field ID 0 collides with ManifestEntry internal fields (status=0, snapshot_id=1, data_file=2), corrupting manifest file schemas. Fix by using kLegacyPartitionDataIdStart - 1 (999) as the baseline, consistent with PartitionSpec's own constructor, Unpartitioned(), and UpdatePartitionSpec, as well as Java Iceberg's PARTITION_DATA_ID_START convention. The first partition field now correctly gets ID 1000.
wgtmac
approved these changes
Jul 14, 2026
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.
FreshPartitionSpec and TableMetadataBuilder::Impl both initialized the
partition field ID counter to
kInvalidPartitionFieldId(-1), causingthe first partition field to get ID 0 instead of 1000. Partition field
ID 0 collides with ManifestEntry internal fields:
ManifestEntry.statusManifestEntry.snapshot_idManifestEntry.data_fileThis corrupts manifest file schemas during serialization and breaks
partition pruning.
Fix
Change both initializers to
kLegacyPartitionDataIdStart - 1(999),consistent with Java Iceberg's
PARTITION_DATA_ID_STARTconvention andthe rest of the C++ codebase (
PartitionSpecconstructor,Unpartitioned(),UpdatePartitionSpec). The first partition fieldnow correctly gets ID 1000.
FreshPartitionSpeccounterTableMetadataBuilder::Impl::last_partition_id