This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new 95f74f1544d [FIX](complextype)fix shrink in topN for complex type
#26609
95f74f1544d is described below
commit 95f74f1544d9ee5173117194af1a599ef2175303
Author: amory <[email protected]>
AuthorDate: Thu Nov 9 10:56:14 2023 +0800
[FIX](complextype)fix shrink in topN for complex type #26609
---
be/src/exec/rowid_fetcher.cpp | 33 ++++++++++++++--------
...test_nestedtypes_csv_insert_into_with_s3.groovy | 1 +
...est_nestedtypes_json_insert_into_with_s3.groovy | 1 +
3 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/be/src/exec/rowid_fetcher.cpp b/be/src/exec/rowid_fetcher.cpp
index 94fcd814bea..c7519c5b05a 100644
--- a/be/src/exec/rowid_fetcher.cpp
+++ b/be/src/exec/rowid_fetcher.cpp
@@ -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:
+ 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());
@@ -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);
diff --git
a/regression-test/suites/datatype_p0/nested_types/query/test_nestedtypes_csv_insert_into_with_s3.groovy
b/regression-test/suites/datatype_p0/nested_types/query/test_nestedtypes_csv_insert_into_with_s3.groovy
index e55c8e540de..ab9dff9ffb2 100644
---
a/regression-test/suites/datatype_p0/nested_types/query/test_nestedtypes_csv_insert_into_with_s3.groovy
+++
b/regression-test/suites/datatype_p0/nested_types/query/test_nestedtypes_csv_insert_into_with_s3.groovy
@@ -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()
diff --git
a/regression-test/suites/datatype_p0/nested_types/query/test_nestedtypes_json_insert_into_with_s3.groovy
b/regression-test/suites/datatype_p0/nested_types/query/test_nestedtypes_json_insert_into_with_s3.groovy
index 68fd6b1f6f1..35d154cbbd0 100644
---
a/regression-test/suites/datatype_p0/nested_types/query/test_nestedtypes_json_insert_into_with_s3.groovy
+++
b/regression-test/suites/datatype_p0/nested_types/query/test_nestedtypes_json_insert_into_with_s3.groovy
@@ -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()
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]