loicalleyne commented on code in PR #427:
URL: https://github.com/apache/iceberg-go/pull/427#discussion_r2087170899


##########
manifest.go:
##########
@@ -1480,6 +1479,33 @@ func avroPartitionData(input map[string]any, nameToID 
map[string]int, logicalTyp
        return out
 }
 
+func avroFieldPartitionData(input map[int]any, logicalTypes 
map[int]avro.LogicalType) map[int]any {
+       out := make(map[int]any)
+       for k, v := range input {
+               if logical, ok := logicalTypes[k]; ok {
+                       switch logical {
+                       case avro.Date:
+                               out[k] = 
Date(v.(time.Time).Truncate(24*time.Hour).Unix() / int64((time.Hour * 
24).Seconds()))
+                       case avro.TimeMillis:
+                               out[k] = Time(v.(time.Duration).Milliseconds())
+                       case avro.TimeMicros:
+                               out[k] = Time(v.(time.Duration).Microseconds())
+                       case avro.TimestampMillis:
+                               out[k] = 
Timestamp(v.(time.Time).UTC().UnixMilli())
+                       case avro.TimestampMicros:
+                               out[k] = 
Timestamp(v.(time.Time).UTC().UnixMicro())
+                       default:
+                               out[k] = v
+                       }
+
+                       continue
+               }
+               out[k] = v
+       }
+
+       return out
+}

Review Comment:
   @zeroshade 
   `dataFile.Partition()` still returns `dataFile.PartitionData`,  even though 
it's not used in `getPartitionRecord`  anymore, we might still want to swap out 
the decoded types for iceberg types, what do you think?



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to