[Bug](type) coredump on get_type_as_primitive_type #24012

This commit is contained in:
Pxl
2023-09-07 11:28:41 +08:00
committed by GitHub
parent 349c090469
commit f13d3008a2
2 changed files with 9 additions and 3 deletions

View File

@ -43,9 +43,12 @@ namespace doris::vectorized {
DataTypeNullable::DataTypeNullable(const DataTypePtr& nested_data_type_)
: nested_data_type {nested_data_type_} {
if (!nested_data_type) {
throw Exception(ErrorCode::INTERNAL_ERROR, "DataTypeNullable input nested type is nullptr");
}
if (!nested_data_type->can_be_inside_nullable()) {
LOG(FATAL) << fmt::format("Nested type {} cannot be inside Nullable type",
nested_data_type->get_name());
throw Exception(ErrorCode::INTERNAL_ERROR, "Nested type {} cannot be inside Nullable type",
nested_data_type->get_name());
}
}

View File

@ -66,6 +66,9 @@ public:
const char* get_family_name() const override { return TypeName<T>::get(); }
TypeIndex get_type_id() const override { return TypeId<T>::value; }
PrimitiveType get_type_as_primitive_type() const override {
if constexpr (std::is_same_v<TypeId<T>, TypeId<UInt8>>) {
return TYPE_BOOLEAN;
}
if constexpr (std::is_same_v<TypeId<T>, TypeId<Int8>>) {
return TYPE_TINYINT;
}
@ -87,7 +90,7 @@ public:
if constexpr (std::is_same_v<TypeId<T>, TypeId<Float64>>) {
return TYPE_DOUBLE;
}
__builtin_unreachable();
return INVALID_TYPE;
}
TPrimitiveType::type get_type_as_tprimitive_type() const override {
if constexpr (std::is_same_v<TypeId<T>, TypeId<Int8>>) {