This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 6b08a4ec93f [Bug](top-n) do not get runtime predicate when predicate 
not initialized #32209
6b08a4ec93f is described below

commit 6b08a4ec93fae67c71db454bbaef92d74043f966
Author: Pxl <pxl...@qq.com>
AuthorDate: Thu Mar 14 09:12:09 2024 +0800

    [Bug](top-n) do not get runtime predicate when predicate not initialized 
#32209
---
 be/src/olap/rowset/segment_v2/segment.cpp          | 3 +++
 be/src/olap/rowset/segment_v2/segment_iterator.cpp | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/be/src/olap/rowset/segment_v2/segment.cpp 
b/be/src/olap/rowset/segment_v2/segment.cpp
index dc563dbd7b6..41f1d0b7d22 100644
--- a/be/src/olap/rowset/segment_v2/segment.cpp
+++ b/be/src/olap/rowset/segment_v2/segment.cpp
@@ -152,6 +152,9 @@ Status Segment::new_iterator(SchemaSPtr schema, const 
StorageReadOptions& read_o
     if (read_options.use_topn_opt) {
         auto* query_ctx = read_options.runtime_state->get_query_ctx();
         for (int id : read_options.topn_filter_source_node_ids) {
+            if (!query_ctx->get_runtime_predicate(id).need_update()) {
+                continue;
+            }
             auto runtime_predicate = 
query_ctx->get_runtime_predicate(id).get_predicate();
 
             int32_t uid =
diff --git a/be/src/olap/rowset/segment_v2/segment_iterator.cpp 
b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
index fe2ee5c7312..8023f3f2d7a 100644
--- a/be/src/olap/rowset/segment_v2/segment_iterator.cpp
+++ b/be/src/olap/rowset/segment_v2/segment_iterator.cpp
@@ -595,6 +595,10 @@ Status 
SegmentIterator::_get_row_ranges_from_conditions(RowRanges* condition_row
             
SCOPED_RAW_TIMER(&_opts.stats->block_conditions_filtered_zonemap_ns);
             auto* query_ctx = _opts.runtime_state->get_query_ctx();
             for (int id : _opts.topn_filter_source_node_ids) {
+                if (!query_ctx->get_runtime_predicate(id).need_update()) {
+                    continue;
+                }
+
                 std::shared_ptr<doris::ColumnPredicate> runtime_predicate =
                         query_ctx->get_runtime_predicate(id).get_predicate();
                 if 
(_segment->can_apply_predicate_safely(runtime_predicate->column_id(),
@@ -1510,6 +1514,10 @@ Status SegmentIterator::_vec_init_lazy_materialization() 
{
     if (_opts.use_topn_opt &&
         (_opts.read_orderby_key_columns == nullptr || 
_opts.read_orderby_key_columns->empty())) {
         for (int id : _opts.topn_filter_source_node_ids) {
+            if 
(!_opts.runtime_state->get_query_ctx()->get_runtime_predicate(id).need_update())
 {
+                continue;
+            }
+
             auto& runtime_predicate =
                     
_opts.runtime_state->get_query_ctx()->get_runtime_predicate(id);
             _col_predicates.push_back(runtime_predicate.get_predicate().get());


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to