in gandiva/src/main/cpp/jni_common.cc [186:246]
DataTypePtr ProtoTypeToDataType(const gandiva::types::ExtGandivaType& ext_type) {
switch (ext_type.type()) {
case gandiva::types::NONE:
return arrow::null();
case gandiva::types::BOOL:
return arrow::boolean();
case gandiva::types::UINT8:
return arrow::uint8();
case gandiva::types::INT8:
return arrow::int8();
case gandiva::types::UINT16:
return arrow::uint16();
case gandiva::types::INT16:
return arrow::int16();
case gandiva::types::UINT32:
return arrow::uint32();
case gandiva::types::INT32:
return arrow::int32();
case gandiva::types::UINT64:
return arrow::uint64();
case gandiva::types::INT64:
return arrow::int64();
case gandiva::types::HALF_FLOAT:
return arrow::float16();
case gandiva::types::FLOAT:
return arrow::float32();
case gandiva::types::DOUBLE:
return arrow::float64();
case gandiva::types::UTF8:
return arrow::utf8();
case gandiva::types::BINARY:
return arrow::binary();
case gandiva::types::DATE32:
return arrow::date32();
case gandiva::types::DATE64:
return arrow::date64();
case gandiva::types::DECIMAL:
// TODO: error handling
return arrow::decimal(ext_type.precision(), ext_type.scale());
case gandiva::types::TIME32:
return ProtoTypeToTime32(ext_type);
case gandiva::types::TIME64:
return ProtoTypeToTime64(ext_type);
case gandiva::types::TIMESTAMP:
return ProtoTypeToTimestamp(ext_type);
case gandiva::types::INTERVAL:
return ProtoTypeToInterval(ext_type);
case gandiva::types::FIXED_SIZE_BINARY:
case gandiva::types::LIST:
case gandiva::types::STRUCT:
case gandiva::types::UNION:
case gandiva::types::DICTIONARY:
case gandiva::types::MAP:
std::cerr << "Unhandled data type: " << ext_type.type() << "\n";
return nullptr;
default:
std::cerr << "Unknown data type: " << ext_type.type() << "\n";
return nullptr;
}
}