zeroshade commented on code in PR #932:
URL: https://github.com/apache/iceberg-go/pull/932#discussion_r3203132120


##########
table/internal/parquet_files.go:
##########
@@ -577,7 +577,23 @@ func (p parquetFormat) DataFileStatsFromMeta(meta 
Metadata, statsCols map[int]St
                                panic(err)
                        }
 
-                       fieldID := colMapping[colChunk.PathInSchema().String()]
+                       fieldID, ok := 
colMapping[colChunk.PathInSchema().String()]
+                       if !ok {
+                               // Variant sub-columns (metadata, value) have 
no Iceberg field ID
+                               // (spec: "must not be assigned field IDs"). 
Skip them only if the
+                               // parent column is a variant field.
+                               path := colChunk.PathInSchema()
+                               if len(path) >= 2 {
+                                       parentPath := 
strings.Join(path[:len(path)-1], ".")
+                                       if parentID, hasParent := 
colMapping[parentPath]; hasParent {
+                                               if _, hasStats := 
statsCols[parentID]; !hasStats {

Review Comment:
   agreed



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