zeroshade commented on code in PR #1774:
URL: https://github.com/apache/iceberg-go/pull/1774#discussion_r3833208113
##########
table/equality_delete_reader.go:
##########
@@ -380,24 +380,28 @@ func readEqualityDeleteFile(ctx context.Context, fs
iceio.IO, tableSchema *icebe
}
defer iceinternal.CheckedClose(rdr, &err)
- tbl, err := rdr.ReadTable(ctx)
+ if nameMapping == nil {
+ nameMapping = tableSchema.NameMapping()
+ }
+
+ projectedIDs := make(map[int]struct{}, len(fieldIDs))
+ for _, fieldID := range fieldIDs {
+ projectedIDs[fieldID] = struct{}{}
+ }
+
+ projectedSchema, colIndices, err := rdr.PrunedSchema(projectedIDs,
nameMapping)
Review Comment:
`PrunedSchema` gives this name mapping precedence over embedded Parquet
field IDs. Because the fallback mapping above is built from the *current* table
names, a legal rename followed by name reuse can prune away the equality field:
for example, a delete file stores ID 1 as `old_name`, while the current schema
has ID 1 renamed to `new_name` and reuses `old_name` for ID 2. I reproduced
that case: the previous materialized reader succeeds using embedded ID 1, while
this path maps the file column to ID 2 and fails with `equality field ID 1 ...
not found`. Please preserve embedded IDs as authoritative and use name mapping
only for files/fields without IDs, with a regression test covering rename plus
name reuse.
--
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]