in arrow/csv/reader.go [263:328]
func (r *Reader) initFieldConverter(field *arrow.Field) func(array.Builder, string) {
switch field.Type.(type) {
case *arrow.BooleanType:
return func(field array.Builder, str string) {
r.parseBool(field, str)
}
case *arrow.Int8Type:
return func(field array.Builder, str string) {
r.parseInt8(field, str)
}
case *arrow.Int16Type:
return func(field array.Builder, str string) {
r.parseInt16(field, str)
}
case *arrow.Int32Type:
return func(field array.Builder, str string) {
r.parseInt32(field, str)
}
case *arrow.Int64Type:
return func(field array.Builder, str string) {
r.parseInt64(field, str)
}
case *arrow.Uint8Type:
return func(field array.Builder, str string) {
r.parseUint8(field, str)
}
case *arrow.Uint16Type:
return func(field array.Builder, str string) {
r.parseUint16(field, str)
}
case *arrow.Uint32Type:
return func(field array.Builder, str string) {
r.parseUint32(field, str)
}
case *arrow.Uint64Type:
return func(field array.Builder, str string) {
r.parseUint64(field, str)
}
case *arrow.Float32Type:
return func(field array.Builder, str string) {
r.parseFloat32(field, str)
}
case *arrow.Float64Type:
return func(field array.Builder, str string) {
r.parseFloat64(field, str)
}
case *arrow.StringType:
// specialize the implementation when we know we cannot have nulls
if r.stringsCanBeNull {
return func(field array.Builder, str string) {
if r.isNull(str) {
field.AppendNull()
} else {
field.(*array.StringBuilder).Append(str)
}
}
} else {
return func(field array.Builder, str string) {
field.(*array.StringBuilder).Append(str)
}
}
default:
panic(fmt.Errorf("arrow/csv: unhandled field type %T", field.Type))
}
}