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


##########
manifest.go:
##########
@@ -583,6 +597,51 @@ func avroColMapToMap[K comparable, V any](c *[]colMap[K, 
V]) map[K]V {
        return out
 }
 
+func avroPartitionData(input map[string]any) map[string]any {
+       // hamba/avro2 will unmarshal a map[string]any such that
+       // each entry will actually be a map[string]interface{} with the key
+       // being the avro type.
+       //
+       // This means that partition data that looks like:
+       //
+       //  [{"field-id": 1000, "name": "ts", "type": {"type": "int", 
"logicalType": "date"}}]
+       //
+       // Becomes:
+       //
+       //  map[string]any{"ts": map[string]any{"int.date": time.Time{}}}
+       //
+       // so we need to simplify our map and make partition data handling 
easier
+       out := map[string]any{}
+       for k, v := range input {
+               switch v := v.(type) {
+               case map[string]any:
+                       for typname, val := range v {
+                               switch typname {
+                               case "int.date":

Review Comment:
   the representation is coming from the `hambra/avro` library. When we 
unmarshal the data, it constructs the type as `type`.`logical-type`.
   
   As described in the comment above, the avro has something like `"type": 
{"type": "int", "logicalType": "date"}` so the `hambra/avro` library will 
denote that with the type `int.date`.
   
   All of the below representations come from the avro specification for 
logical types



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