kevinjqliu commented on code in PR #427:
URL: https://github.com/apache/iceberg-go/pull/427#discussion_r2087170419
##########
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:
we might want to clean up any old implementations thats using field name as
its not the recommended way to access partition data. For example,
`DataFile.Partition()`
--
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]