You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by hu...@apache.org on 2025/11/06 03:25:30 UTC
(doris) 17/18: fix: missed pruned type with map/array types
This is an automated email from the ASF dual-hosted git repository.
huajianlan pushed a commit to branch nested_column_prune
in repository https://gitbox.apache.org/repos/asf/doris.git
commit 05c28879f0b13f467503487c876a21a0781a8222
Author: Hu Shenggang <hu...@selectdb.com>
AuthorDate: Tue Nov 4 14:26:08 2025 +0800
fix: missed pruned type with map/array types
---
be/src/http/action/debug_point_action.cpp | 4 +++-
be/src/olap/rowset/segment_v2/column_reader.cpp | 2 ++
be/src/olap/tablet_schema.cpp | 5 +++-
be/src/vec/exec/scan/olap_scanner.cpp | 4 +++-
.../complex_types/test_pruned_columns.out | 7 ++++++
.../complex_types/test_pruned_columns.groovy | 27 ++++++++++++++++++++++
6 files changed, 46 insertions(+), 3 deletions(-)
diff --git a/be/src/http/action/debug_point_action.cpp b/be/src/http/action/debug_point_action.cpp
index 04aa38efaa4..600ae645341 100644
--- a/be/src/http/action/debug_point_action.cpp
+++ b/be/src/http/action/debug_point_action.cpp
@@ -35,11 +35,13 @@ void BaseDebugPointAction::handle(HttpRequest* req) {
"Disable debug points. please check config::enable_debug_points");
}
std::string result = status.to_json();
- LOG(INFO) << "handle request result:" << result;
+ LOG(INFO) << "handle request result:" << result << ", status: " << status.to_string();
if (status.ok()) {
+ LOG(INFO) << "***** send ok";
HttpChannel::send_reply(req, HttpStatus::OK, result);
} else {
HttpChannel::send_reply(req, HttpStatus::INTERNAL_SERVER_ERROR, result);
+ LOG(INFO) << "***** send error";
}
}
diff --git a/be/src/olap/rowset/segment_v2/column_reader.cpp b/be/src/olap/rowset/segment_v2/column_reader.cpp
index 0cecd06e60e..822b5d31332 100644
--- a/be/src/olap/rowset/segment_v2/column_reader.cpp
+++ b/be/src/olap/rowset/segment_v2/column_reader.cpp
@@ -945,6 +945,8 @@ Result<TColumnAccessPaths> ColumnIterator::_get_sub_access_paths(
if (!name_path.data_access_path.path.empty()) {
++it;
} else {
+ LOG(INFO) << "********* set _column_name: " << _column_name
+ << " need_to_read true **********";
set_need_to_read();
it = sub_access_paths.erase(it);
}
diff --git a/be/src/olap/tablet_schema.cpp b/be/src/olap/tablet_schema.cpp
index cee5f53ae6b..e231ba88106 100644
--- a/be/src/olap/tablet_schema.cpp
+++ b/be/src/olap/tablet_schema.cpp
@@ -1684,11 +1684,14 @@ vectorized::Block TabletSchema::create_block(
tablet_columns_need_convert_null->find(cid) !=
tablet_columns_need_convert_null->end());
auto data_type = vectorized::DataTypeFactory::instance().create_data_type(col, is_nullable);
- if (col.type() == FieldType::OLAP_FIELD_TYPE_STRUCT) {
+ if (col.type() == FieldType::OLAP_FIELD_TYPE_STRUCT ||
+ col.type() == FieldType::OLAP_FIELD_TYPE_MAP ||
+ col.type() == FieldType::OLAP_FIELD_TYPE_ARRAY) {
if (_pruned_columns_data_type.contains(col.unique_id())) {
data_type = _pruned_columns_data_type.at(col.unique_id());
}
}
+
if (_vir_col_idx_to_unique_id.contains(cid)) {
block.insert({vectorized::ColumnNothing::create(0), data_type, col.name()});
VLOG_DEBUG << fmt::format(
diff --git a/be/src/vec/exec/scan/olap_scanner.cpp b/be/src/vec/exec/scan/olap_scanner.cpp
index 51fc4daa669..df48549895d 100644
--- a/be/src/vec/exec/scan/olap_scanner.cpp
+++ b/be/src/vec/exec/scan/olap_scanner.cpp
@@ -556,7 +556,9 @@ Status OlapScanner::_init_return_columns() {
{column.unique_id(), slot->predicate_access_paths()});
}
- if (slot->type()->get_primitive_type() == PrimitiveType::TYPE_STRUCT &&
+ if ((slot->type()->get_primitive_type() == PrimitiveType::TYPE_STRUCT ||
+ slot->type()->get_primitive_type() == PrimitiveType::TYPE_MAP ||
+ slot->type()->get_primitive_type() == PrimitiveType::TYPE_ARRAY) &&
!slot->all_access_paths().empty()) {
tablet_schema->add_pruned_columns_data_type(column.unique_id(), slot->type());
}
diff --git a/regression-test/data/datatype_p0/complex_types/test_pruned_columns.out b/regression-test/data/datatype_p0/complex_types/test_pruned_columns.out
index 74f336d27e5..870a5763074 100644
--- a/regression-test/data/datatype_p0/complex_types/test_pruned_columns.out
+++ b/regression-test/data/datatype_p0/complex_types/test_pruned_columns.out
@@ -22,3 +22,10 @@
1 beijing
2 shanghai
+-- !sql6 --
+2
+
+-- !sql7 --
+0.41
+0.99
+
diff --git a/regression-test/suites/datatype_p0/complex_types/test_pruned_columns.groovy b/regression-test/suites/datatype_p0/complex_types/test_pruned_columns.groovy
index ad032fab8f2..d54d924e97f 100644
--- a/regression-test/suites/datatype_p0/complex_types/test_pruned_columns.groovy
+++ b/regression-test/suites/datatype_p0/complex_types/test_pruned_columns.groovy
@@ -58,4 +58,31 @@ suite("test_pruned_columns") {
qt_sql5 """
select id, struct_element(s, 'city') from `tbl_test_pruned_columns` where struct_element(struct_element(s, 'data')[1][2], 'b') = 40 order by 1;
"""
+
+ sql """DROP TABLE IF EXISTS `tbl_test_pruned_columns_map`"""
+ sql """
+ CREATE TABLE `tbl_test_pruned_columns_map` (
+ `id` bigint NULL,
+ `dynamic_attributes` map<text,struct<attribute_value:text,confidence_score:double,last_updated:datetime>> NULL
+ ) ENGINE=OLAP
+ DUPLICATE KEY(`id`)
+ DISTRIBUTED BY RANDOM BUCKETS AUTO
+ PROPERTIES (
+ "replication_allocation" = "tag.location.default: 1"
+ );
+ """
+
+ sql """
+ insert into `tbl_test_pruned_columns_map` values
+ (1, '{"theme_preference":{"attribute_value":"light", "confidence_score":0.41, "last_updated":"2025-11-03 15:32:33"}, "language_setting":{"attribute_value":"es", "confidence_score":0.65, "last_updated":"2025-11-03 15:32:33"}}'),
+ (2, '{"theme_preference":{"attribute_value":"light", "confidence_score":0.99, "last_updated":"2025-11-03 15:32:33"}, "language_setting":{"attribute_value":"es", "confidence_score":0.92, "last_updated":"2025-11-03 15:32:33"}}');
+ """
+
+ qt_sql6 """
+ select count(struct_element(dynamic_attributes['theme_preference'], 'confidence_score')) from `tbl_test_pruned_columns_map`;
+ """
+
+ qt_sql7 """
+ select struct_element(dynamic_attributes['theme_preference'], 'confidence_score') from `tbl_test_pruned_columns_map` order by id;
+ """
}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org