Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 22 additions & 11 deletions be/src/exec/rowid_fetcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,24 @@ Status RowIDFetcher::_merge_rpc_results(const PMultiGetRequest& request,
return Status::OK();
}

bool _has_char_type(const TypeDescriptor& desc) {
switch (desc.type) {
case TYPE_CHAR:
return true;
case TYPE_ARRAY:
case TYPE_MAP:
case TYPE_STRUCT:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we make it more general to just check children

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could not. It has to check the child recursively.....

for (int idx = 0; idx < desc.children.size(); ++idx) {
if (_has_char_type(desc.children[idx])) {
return true;
}
}
return false;
default:
return false;
}
}

Status RowIDFetcher::fetch(const vectorized::ColumnPtr& column_row_ids,
vectorized::Block* res_block) {
CHECK(!_stubs.empty());
Expand Down Expand Up @@ -238,17 +256,10 @@ Status RowIDFetcher::fetch(const vectorized::ColumnPtr& column_row_ids,
std::vector<size_t> char_type_idx;
for (size_t i = 0; i < _fetch_option.desc->slots().size(); i++) {
const auto& column_desc = _fetch_option.desc->slots()[i];
const TypeDescriptor* type_desc = &column_desc->type();
do {
if (type_desc->type == TYPE_CHAR) {
char_type_idx.emplace_back(i);
break;
} else if (type_desc->type != TYPE_ARRAY) {
break;
}
// for Array<Char> or Array<Array<Char>>
type_desc = &type_desc->children[0];
} while (true);
const TypeDescriptor& type_desc = column_desc->type();
if (_has_char_type(type_desc)) {
char_type_idx.push_back(i);
}
}
res_block->shrink_char_type_column_suffix_zero(char_type_idx);
VLOG_DEBUG << "dump block:" << res_block->dump_data(0, 10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ suite("test_nestedtypes_csv_insert_into_with_s3", "p0") {
sql 'use regression_test_datatype_p0_nested_types'
sql 'set enable_nereids_planner=false'
sql 'set max_allowed_packet=4194304'
sql 'set topn_opt_limit_threshold=10000'
sql """ADMIN SET FRONTEND CONFIG ('disable_nested_complex_type' = 'false')"""

String ak = getS3AK()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ suite("test_nestedtypes_json_insert_into_with_s3", "p0") {
sql 'use regression_test_datatype_p0_nested_types'
sql 'set enable_nereids_planner=false'
sql 'set max_allowed_packet=4194304'
sql 'set topn_opt_limit_threshold=10000'
sql """ADMIN SET FRONTEND CONFIG ('disable_nested_complex_type' = 'false')"""

String ak = getS3AK()
Expand Down