in extensions/nanoarrow_ipc/src/nanoarrow/nanoarrow_ipc_decoder.c [700:754]
static int ArrowIpcDecoderSetType(struct ArrowSchema* schema, ns(Field_table_t) field,
int64_t n_children, struct ArrowError* error) {
int type_type = ns(Field_type_type(field));
switch (type_type) {
case ns(Type_Null):
return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_NA, error);
case ns(Type_Bool):
return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_BOOL, error);
case ns(Type_Int):
return ArrowIpcDecoderSetTypeInt(schema, ns(Field_type_get(field)), error);
case ns(Type_FloatingPoint):
return ArrowIpcDecoderSetTypeFloatingPoint(schema, ns(Field_type_get(field)),
error);
case ns(Type_Decimal):
return ArrowIpcDecoderSetTypeDecimal(schema, ns(Field_type_get(field)), error);
case ns(Type_Binary):
return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_BINARY, error);
case ns(Type_LargeBinary):
return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_LARGE_BINARY, error);
case ns(Type_FixedSizeBinary):
return ArrowIpcDecoderSetTypeFixedSizeBinary(schema, ns(Field_type_get(field)),
error);
case ns(Type_Utf8):
return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_STRING, error);
case ns(Type_LargeUtf8):
return ArrowIpcDecoderSetTypeSimple(schema, NANOARROW_TYPE_LARGE_STRING, error);
case ns(Type_Date):
return ArrowIpcDecoderSetTypeDate(schema, ns(Field_type_get(field)), error);
case ns(Type_Time):
return ArrowIpcDecoderSetTypeTime(schema, ns(Field_type_get(field)), error);
case ns(Type_Timestamp):
return ArrowIpcDecoderSetTypeTimestamp(schema, ns(Field_type_get(field)), error);
case ns(Type_Duration):
return ArrowIpcDecoderSetTypeDuration(schema, ns(Field_type_get(field)), error);
case ns(Type_Interval):
return ArrowIpcDecoderSetTypeInterval(schema, ns(Field_type_get(field)), error);
case ns(Type_Struct_):
return ArrowIpcDecoderSetTypeSimpleNested(schema, "+s", error);
case ns(Type_List):
return ArrowIpcDecoderSetTypeSimpleNested(schema, "+l", error);
case ns(Type_LargeList):
return ArrowIpcDecoderSetTypeSimpleNested(schema, "+L", error);
case ns(Type_FixedSizeList):
return ArrowIpcDecoderSetTypeFixedSizeList(schema, ns(Field_type_get(field)),
error);
case ns(Type_Map):
return ArrowIpcDecoderSetTypeMap(schema, ns(Field_type_get(field)), error);
case ns(Type_Union):
return ArrowIpcDecoderSetTypeUnion(schema, ns(Field_type_get(field)), n_children,
error);
default:
ArrowErrorSet(error, "Unrecognized Field type with value %d", (int)type_type);
return EINVAL;
}
}