[feature-wip](array-type) Fix conflict while merge array-type branch (#8594)

This commit is contained in:
camby
2022-03-22 16:35:30 +08:00
committed by GitHub
parent b522de884c
commit 9f0b93e3c6
3 changed files with 6 additions and 9 deletions

View File

@ -498,12 +498,9 @@ vectorized::Block TabletSchema::create_block(const std::vector<uint32_t>& return
vectorized::Block block;
for (int i = 0; i < return_columns.size(); ++i) {
const auto& col = _cols[return_columns[i]];
/* TODO:
- auto data_type = vectorized::IDataType::from_olap_engine(col.type(),
- col.is_nullable() || (tablet_columns_need_convert_null != nullptr &&
- tablet_columns_need_convert_null->find(return_columns[i]) != tablet_columns_need_convert_null->end()));
*/
auto data_type = vectorized::DataTypeFactory::instance().create_data_type(col);
bool is_nullable = (tablet_columns_need_convert_null != nullptr &&
tablet_columns_need_convert_null->find(return_columns[i]) != tablet_columns_need_convert_null->end());
auto data_type = vectorized::DataTypeFactory::instance().create_data_type(col, is_nullable);
auto column = data_type->create_column();
block.insert({std::move(column), data_type, col.name()});
}

View File

@ -37,7 +37,7 @@ DataTypePtr DataTypeFactory::create_data_type(const doris::Field& col_desc) {
return nested;
}
DataTypePtr DataTypeFactory::create_data_type(const TabletColumn& col_desc) {
DataTypePtr DataTypeFactory::create_data_type(const TabletColumn& col_desc, bool is_nullable) {
DataTypePtr nested = nullptr;
if (col_desc.type() == OLAP_FIELD_TYPE_ARRAY) {
DCHECK(col_desc.get_subtype_count() == 1);
@ -46,7 +46,7 @@ DataTypePtr DataTypeFactory::create_data_type(const TabletColumn& col_desc) {
nested = _create_primitive_data_type(col_desc.type());
}
if (col_desc.is_nullable() && nested) {
if ((is_nullable || col_desc.is_nullable()) && nested) {
return std::make_shared<DataTypeNullable>(nested);
}
return nested;

View File

@ -81,7 +81,7 @@ public:
}
DataTypePtr create_data_type(const doris::Field& col_desc);
DataTypePtr create_data_type(const TabletColumn& col_desc);
DataTypePtr create_data_type(const TabletColumn& col_desc, bool is_nullable = false);
DataTypePtr create_data_type(const TypeDescriptor& col_desc, bool is_nullable = true);