in spark/sql/types/arrow.go [335:376]
func ArrowTypeToProto(dataType arrow.DataType) *proto.DataType {
switch dataType.ID() {
case arrow.BOOL:
return &proto.DataType{Kind: &proto.DataType_Boolean_{}}
case arrow.INT8:
return &proto.DataType{Kind: &proto.DataType_Byte_{}}
case arrow.INT16:
return &proto.DataType{Kind: &proto.DataType_Short_{}}
case arrow.INT32:
return &proto.DataType{Kind: &proto.DataType_Integer_{}}
case arrow.INT64:
return &proto.DataType{Kind: &proto.DataType_Long_{}}
case arrow.FLOAT16:
return &proto.DataType{Kind: &proto.DataType_Float_{}}
case arrow.FLOAT32:
return &proto.DataType{Kind: &proto.DataType_Double_{}}
case arrow.FLOAT64:
return &proto.DataType{Kind: &proto.DataType_Double_{}}
case arrow.DECIMAL | arrow.DECIMAL128:
return &proto.DataType{Kind: &proto.DataType_Decimal_{}}
case arrow.DECIMAL256:
return &proto.DataType{Kind: &proto.DataType_Decimal_{}}
case arrow.STRING:
return &proto.DataType{Kind: &proto.DataType_String_{}}
case arrow.BINARY:
return &proto.DataType{Kind: &proto.DataType_Binary_{}}
case arrow.TIMESTAMP:
return &proto.DataType{Kind: &proto.DataType_Timestamp_{}}
case arrow.DATE64:
return &proto.DataType{Kind: &proto.DataType_Date_{}}
case arrow.LIST:
return &proto.DataType{Kind: &proto.DataType_Array_{
Array: &proto.DataType_Array{
ElementType: ArrowTypeToProto(dataType.(*arrow.ListType).Elem()),
},
}}
case arrow.STRUCT:
return &proto.DataType{Kind: arrowStructToProtoStruct(dataType.(*arrow.StructType))}
default:
return &proto.DataType{Kind: &proto.DataType_Unparsed_{}}
}
}