Commit 697891b
authored
fix: use kLegacyPartitionDataIdStart as partition field ID baseline (#832)
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:
| Field | ID |
|---|---|
| `ManifestEntry.status` | 0 |
| `ManifestEntry.snapshot_id` | 1 |
| `ManifestEntry.data_file` | 2 |
This 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_START` convention and
the rest of the C++ codebase (`PartitionSpec` constructor,
`Unpartitioned()`, `UpdatePartitionSpec`). The first partition field
now correctly gets ID **1000**.
| Location | Before | After |
|---|---|---|
| `FreshPartitionSpec` counter | -1 | 999 |
| `TableMetadataBuilder::Impl::last_partition_id` | -1 | 999 |
| First partition field ID | 0 | **1000** |1 parent 330de84 commit 697891b
2 files changed
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
556 | 556 | | |
557 | 557 | | |
558 | 558 | | |
559 | | - | |
| 559 | + | |
560 | 560 | | |
561 | 561 | | |
562 | 562 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
125 | 125 | | |
126 | 126 | | |
127 | 127 | | |
128 | | - | |
| 128 | + | |
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
| |||
0 commit comments