badalprasadsingh commented on code in PR #524:
URL: https://github.com/apache/iceberg-go/pull/524#discussion_r2323987957


##########
manifest.go:
##########
@@ -416,30 +429,53 @@ func getFieldIDMap(sc avro.Schema) (map[string]int, 
map[int]avro.LogicalType) {
 
        result := make(map[string]int)
        logicalTypes := make(map[int]avro.LogicalType)
+       fixedSizes := make(map[int]int)
+
        entryField := getField(sc.(*avro.RecordSchema), "data_file")
        partitionField := getField(entryField.Type().(*avro.RecordSchema), 
"partition")
 
        for _, field := range 
partitionField.Type().(*avro.RecordSchema).Fields() {
-               if fid, ok := field.Prop("field-id").(float64); ok {
-                       result[field.Name()] = int(fid)
-                       avroTyp := field.Type()
-                       if us, ok := avroTyp.(*avro.UnionSchema); ok {
-                               for _, t := range us.Types() {
-                                       avroTyp = t
-                               }
+               var fid int
+               switch v := field.Prop("field-id").(type) {

Review Comment:
   well, when `avro` schemas are parsed from JSON, the field.Prop("field-id") 
can return different numeric types depending on:
   
   JSON Number Parsing: JSON doesn't distinguish between integer types - a 
number like `123` could be unmarshaled as `int`, `int32`, `int64`, or `float64` 
depending on the JSON parser's implementation and the value's magnitude.
   
   Had a thorough testing on this, this `fix` should work fine.



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