in catalog/glue/schema.go [60:115]
func icebergTypeToGlueType(typ iceberg.Type) string {
switch t := typ.(type) {
case iceberg.BooleanType:
return "boolean"
case iceberg.Int32Type:
return "int"
case iceberg.Int64Type:
return "bigint"
case iceberg.Float32Type:
return "float"
case iceberg.Float64Type:
return "double"
case iceberg.DateType:
return "date"
case iceberg.TimeType:
return "string"
case iceberg.TimestampType:
return "timestamp"
case iceberg.TimestampTzType:
return "timestamp"
case iceberg.StringType:
return "string"
case iceberg.UUIDType:
return "string" // Represent UUID as string
case iceberg.BinaryType:
return "binary"
case iceberg.DecimalType:
return fmt.Sprintf("decimal(%d,%d)", t.Precision(), t.Scale())
case iceberg.FixedType:
return fmt.Sprintf("binary(%d)", t.Len())
case *iceberg.StructType:
// For struct types, create a struct<field1:type1,field2:type2,...> representation
var fieldStrings []string
for _, field := range t.Fields() {
fieldStrings = append(fieldStrings,
fmt.Sprintf("%s:%s", field.Name, icebergTypeToGlueType(field.Type)))
}
return fmt.Sprintf("struct<%s>", strings.Join(fieldStrings, ","))
case *iceberg.ListType:
// For list types, create an array<type> representation
elementField := t.ElementField()
return fmt.Sprintf("array<%s>", icebergTypeToGlueType(elementField.Type))
case *iceberg.MapType:
// For map types, create a map<keyType,valueType> representation
keyField := t.KeyField()
valueField := t.ValueField()
return fmt.Sprintf("map<%s,%s>",
icebergTypeToGlueType(keyField.Type),
icebergTypeToGlueType(valueField.Type))
default:
return "string"
}
}