zeroshade commented on code in PR #2025:
URL: https://github.com/apache/iceberg-go/pull/2025#discussion_r4168186713
##########
table/equality_delete_reader.go:
##########
@@ -470,21 +599,16 @@ func (l *lazyEqualityDeleteLoader) load(ctx
context.Context, task FileScanTask)
return nil, nil
}
- return []*equalityDeleteSet{fileSet.equalityDeleteSet}, nil
+ return file.singleSet[:], nil
Review Comment:
Nit: every task whose only equality delete is this file now shares the slice
`load` returns. That's safe for today's only consumer, which just ranges over
it, but nothing on `load` says the slice is shared. Either document that
callers must not modify it, or drop `singleSet`. It saves one 8-byte allocation
per data file.
##########
table/equality_delete_reader.go:
##########
@@ -509,38 +629,91 @@ func (l *lazyEqualityDeleteLoader) load(ctx
context.Context, task FileScanTask)
// kept as separate sets (not merged).
func readAllEqualityDeleteFiles(ctx context.Context, fs iceio.IO, schema
*iceberg.Schema, nameMapping iceberg.NameMapping, tasks []FileScanTask,
concurrency int) (map[int][]*equalityDeleteSet, error) {
type deleteFileInfo struct {
- id int
- file iceberg.DataFile
- fieldIDs []int
+ id int
+ file iceberg.DataFile
+ fieldIDs []int
+ hasPointerIdentity bool
}
- uniqueDeletes := make(map[string]deleteFileInfo)
- hasAny := false
+ var (
+ firstPath string
+ firstInfo deleteFileInfo
+ hasFirst bool
+ uniqueDeletes map[string]deleteFileInfo
+ )
for _, t := range tasks {
for _, d := range t.EqualityDeleteFiles {
+ if hasFirst && uniqueDeletes == nil &&
Review Comment:
Nit: `readAllEqualityDeleteFiles` is only called from tests and benchmarks,
so this copied first-path fast path only speeds up tests and is a second copy
of the lazy loader's logic. I'd revert the eager side to the plain map loop,
keeping the cached `hasPointerIdentity`.
--
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]