Revanth14 opened a new pull request, #1867:
URL: https://github.com/apache/iceberg-go/pull/1867

   ### Description
   
   This PR validates required identity fields when parsing table metadata:
   
   - Rejects missing, null, or empty `location` for format versions 1–3.
   - Rejects missing, null, or zero-valued `table-uuid` for format versions 2–3.
   - Preserves v1 compatibility by allowing an absent `table-uuid`.
   - Fixes v1-to-v2 conversion so a UUID is generated when the v1 metadata has 
no UUID.
   - Updates affected test fixtures to contain valid required fields.
   
   Validation is performed at the JSON parsing boundary rather than in the 
shared metadata validator. This keeps the existing create-via-commit staging 
flow valid, where metadata may temporarily have an empty location before it is 
persisted.
   
   ### Why are these changes needed?
   
   Previously, invalid table metadata was silently accepted:
   
   - A missing location became `""`.
   - A missing UUID became `uuid.Nil`.
   
   This could cause location providers to produce bogus relative paths and 
could make `assert-table-uuid` requirements incorrectly match unrelated 
UUID-less tables.
   
   The behavior now matches the Iceberg requirements for the currently 
supported format versions. Two deliberate deltas from Java: `"location": ""` 
and an explicitly all-zeros `table-uuid` are rejected here, where Java only 
checks for null. Both are covered by tests. If format v4 support is added, 
location validation will need to account for location becoming optional.
   
   **Note: this is a behavior change.** Metadata that previously parsed 
successfully may now return an error.
   
   Real-world compatibility risk is limited:
   
   - Normal table creation generates a UUID through `NewMetadata`.
   - Builder-based v1-to-v2/v3 upgrades assign a UUID through 
`SetFormatVersion`.
   - Create-via-commit temporarily constructs metadata with an empty location, 
but supplies the actual location through an update before persistence.
   
   Malformed externally produced metadata and the direct v1-to-v2 conversion 
path are the primary cases affected. This behavior change may warrant a release 
note.
   
   ### Tests
   
   Added coverage for:
   
   - Missing, null, and empty locations across v1–v3.
   - Missing, null, and zero UUIDs across v2–v3.
   - v1 compatibility for absent UUIDs.
   - UUID generation during v1-to-v2 conversion.
   - Successful reparsing of converted metadata.
   
   Validated with:
   
   - `go test ./... -count=1`
   - `go vet -tags=integration ./...`
   
   Closes #1864
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to