[refactor](typesystem) using typeindex to create column instead of type name because type name is not stable (#18328)

---------

Co-authored-by: yiguolei <yiguolei@gmail.com>
This commit is contained in:
yiguolei
2023-04-09 18:08:31 +08:00
committed by GitHub
parent 8a4a92f658
commit f38e00b4c0
12 changed files with 340 additions and 367 deletions

View File

@ -38,9 +38,13 @@ doris::Status VCastExpr::prepare(doris::RuntimeState* state, const doris::RowDes
// create a const string column
_target_data_type = _data_type;
// TODO(xy): support return struct type name
_target_data_type_name = DataTypeFactory::instance().get(_target_data_type);
_cast_param_data_type = std::make_shared<DataTypeString>();
_cast_param = _cast_param_data_type->create_column_const(1, _target_data_type_name);
_target_data_type_name = _target_data_type->get_name();
// Using typeindex to indicate the datatype, not using type name because
// type name is not stable, but type index is stable and immutable
_cast_param_data_type = _target_data_type;
// Has to cast to int16_t or there will be compile error because there is no
// TypeIndexField
_cast_param = _cast_param_data_type->create_column_const_with_default_value(1);
ColumnsWithTypeAndName argument_template;
argument_template.reserve(2);