laskoviymishka commented on code in PR #2597:
URL: https://github.com/apache/iceberg-go/pull/2597#discussion_r4693717421


##########
table/internal/parquet_files.go:
##########
@@ -2041,16 +2073,18 @@ func (p parquetFormat) DataFileStatsFromMeta(meta 
Metadata, statsCols map[int]St
        }
 
        slices.Sort(splitOffsets)
-       maps.DeleteFunc(nullValueCounts, func(fieldID int, _ int64) bool {
-               _, ok := invalidateCol[fieldID]
-
-               return ok
-       })
-       maps.DeleteFunc(colAggs, func(fieldID int, _ StatsAgg) bool {
-               _, ok := invalidateCol[fieldID]
-
-               return ok
-       })
+       for fieldID := range invalidateCol {

Review Comment:
   Could the `invalidateCol` branch after `wrapStatsForType` also set 
`incompleteBounds[fieldID] = nil`? It still lets inference write a nil identity 
partition with no error 
([L2063-L2067](https://github.com/apache/iceberg-go/blob/2cdeacca390cda30924be74c88f8e518c5fa3053/table/internal/parquet_files.go#L2063-L2067)).
 A `decimal(5,2)` source stored as FLBA(16) reaches it: `FileToDataFile` 
returns `partition={1000:<nil>}` and empty bounds. `main` behaves the same, but 
this PR is where inference starts requiring complete bounds.



##########
table/internal/parquet_files.go:
##########
@@ -1988,23 +2008,28 @@ func (p parquetFormat) DataFileStatsFromMeta(meta 
Metadata, statsCols map[int]St
                        }
 
                        if !set {
-                               invalidateCol[fieldID] = struct{}{}
+                               missingNulls[fieldID] = struct{}{}
+                               incompleteBounds[fieldID] = nil

Review Comment:
   Should the `!set` and `stats == nil` branches skip chunks where 
`colChunk.NumValues() == 0`? An empty, stats-less row group now puts the source 
column in `incompleteBounds` 
([L2010-L2023](https://github.com/apache/iceberg-go/blob/2cdeacca390cda30924be74c88f8e518c5fa3053/table/internal/parquet_files.go#L2010-L2023)),
 so `ToDataFile` fails with "incomplete Parquet bounds" even when the other row 
groups give one value. `main` wrote a nil partition there, so the error is the 
safer outcome. The repro edits the footer by hand, and I'm not sure real 
writers emit such row groups.



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