hcrosse commented on PR #2675:
URL: https://github.com/apache/iceberg-go/pull/2675#issuecomment-7111925073

   Thanks for the review! I updated the branch and merged `main` (including 
`#2677`) to cover both points and the nits:
   
   1. Standard `AddDataFilesByPath`, name mapping, and `arrowScan` paths cannot 
pair a millisecond Parquet column with `timestamp_ns` (`PromoteType` rejects 
`timestamp` to `timestamp_ns`, `fileSchema` derives from the normalized Parquet 
schema, and files without Parquet field IDs have no row group bounds). However, 
`DataFileFromMetadata` bypasses compatibility checks and direct `TestRowGroup` 
callers can bind `timestamp_ns`. Both `parquetStatsBounds` (resolving the bound 
field type lazily from the expression only when a millisecond column appears, 
so normal scans pay nothing) and `wrapStatsForType` now scale only for 
`TimestampType` and `TimestampTzType`, and omit min and max bounds for any 
other type while keeping value and null counts intact across row groups in 
`DataFileStatsFromMeta`.
   
   2. I benchmarked the builder loop against safe `compute.CastArray` and a 
direct `[]arrow.Timestamp` buffer path that reuses the validity bitmap (zero 
copy at offset 0, sliced for byte aligned offsets, copied only for unaligned 
offsets) and checks `IsNull` only on the cold overflow branch. On Apple M4 Max 
(`-count=6` medians):
   
   | Case | Builder | `compute.CastArray` | Direct buffer |
   | --- | --- | --- | --- |
   | `no_nulls` (128 rows) | 857 ns, 2880 B, 8 allocs | 3226 ns, 3202 B, 36 
allocs | 328 ns, 1520 B, 6 allocs |
   | `no_nulls` (131,072 rows) | 470 µs, 2.15 MB, 8 allocs | 91 µs, 1.06 MB, 36 
allocs | 110 µs, 1.06 MB, 6 allocs |
   | `nulls_10pct` (131,072 rows) | 461 µs, 2.15 MB, 8 allocs | 150 µs, 1.08 
MB, 39 allocs | 110 µs, 1.06 MB, 6 allocs |
   | `all_nulls` (131,072 rows) | 324 µs, 2.15 MB, 8 allocs | 138 µs, 1.08 MB, 
39 allocs | 37 µs, 1.06 MB, 6 allocs |
   | `dictionary` (131,072 rows) | 697 ns, 2209 B, 15 allocs | 3217 ns, 3105 B, 
43 allocs | 394 ns, 1425 B, 13 allocs |
   
   The direct buffer path won 14 of 15 cases (up to 10x faster than `CastArray` 
on small and dictionary batches with 6x fewer allocations because it avoids per 
call goroutine setup and bitmap copies), so I switched 
`normalizeTimestampMillisArray` to it and added edge tests for sliced arrays 
and out of range null slot payloads under `CheckedAllocator`.
   
   3. Added the comment on union, run end encoded, and extension types in 
`normalizeTimestampMillisType`, renamed `dictionaryMem` to `mem`, and merged 
`main` with a scan test combining `WithDictionaryColumns` and a millisecond 
timestamp column (`ReadDictionaries` runs before `PrunedSchema` and 
`GetRecords`, so normalization already runs on the rebuilt manifest). Agreed on 
keeping divisible by 1000 dictionary and bloom literal conversion as a follow 
up.
   


-- 
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