[feature](jsonb type) functions for cast from and to jsonb datatype (#13379)
This commit is contained in:
@ -58,6 +58,15 @@ size_t type_index_to_data_type(const std::vector<std::any>& input_types, size_t
|
||||
TypeIndex tp;
|
||||
if (input_types[index].type() == typeid(Consted)) {
|
||||
tp = std::any_cast<Consted>(input_types[index]).tp;
|
||||
} else if (input_types[index].type() == typeid(ConstedNotnull)) {
|
||||
tp = std::any_cast<ConstedNotnull>(input_types[index]).tp;
|
||||
ut_desc.is_nullable = false;
|
||||
} else if (input_types[index].type() == typeid(Nullable)) {
|
||||
tp = std::any_cast<Nullable>(input_types[index]).tp;
|
||||
ut_desc.is_nullable = true;
|
||||
} else if (input_types[index].type() == typeid(Notnull)) {
|
||||
tp = std::any_cast<Notnull>(input_types[index]).tp;
|
||||
ut_desc.is_nullable = false;
|
||||
} else {
|
||||
tp = std::any_cast<TypeIndex>(input_types[index]);
|
||||
}
|
||||
@ -75,6 +84,10 @@ size_t type_index_to_data_type(const std::vector<std::any>& input_types, size_t
|
||||
desc.type = doris_udf::FunctionContext::TYPE_OBJECT;
|
||||
type = std::make_shared<DataTypeBitMap>();
|
||||
return 1;
|
||||
case TypeIndex::UInt8:
|
||||
desc.type = doris_udf::FunctionContext::TYPE_BOOLEAN;
|
||||
type = std::make_shared<DataTypeUInt8>();
|
||||
return 1;
|
||||
case TypeIndex::Int8:
|
||||
desc.type = doris_udf::FunctionContext::TYPE_TINYINT;
|
||||
type = std::make_shared<DataTypeInt8>();
|
||||
@ -156,7 +169,8 @@ bool parse_ut_data_type(const std::vector<std::any>& input_types, ut_type::UTDat
|
||||
descs.reserve(input_types.size());
|
||||
for (size_t i = 0; i < input_types.size();) {
|
||||
ut_type::UTDataTypeDesc desc;
|
||||
if (input_types[i].type() == typeid(Consted)) {
|
||||
if (input_types[i].type() == typeid(Consted) ||
|
||||
input_types[i].type() == typeid(ConstedNotnull)) {
|
||||
desc.is_const = true;
|
||||
}
|
||||
size_t res = type_index_to_data_type(input_types, i, desc, desc.data_type);
|
||||
@ -214,6 +228,9 @@ bool insert_cell(MutableColumnPtr& column, DataTypePtr type_ptr, const std::any&
|
||||
} else if (type.idx == TypeIndex::BitMap) {
|
||||
BitmapValue* bitmap = std::any_cast<BitmapValue*>(cell);
|
||||
column->insert_data((char*)bitmap, sizeof(BitmapValue));
|
||||
} else if (type.is_uint8()) {
|
||||
auto value = std::any_cast<ut_type::BOOLEAN>(cell);
|
||||
column->insert_data(reinterpret_cast<char*>(&value), 0);
|
||||
} else if (type.is_int8()) {
|
||||
auto value = std::any_cast<ut_type::TINYINT>(cell);
|
||||
column->insert_data(reinterpret_cast<char*>(&value), 0);
|
||||
|
||||
Reference in New Issue
Block a user