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

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


The following commit(s) were added to refs/heads/branch-1.1-lts by this push:
     new 9afd120c72 [fix](sequence) fix that update table core dump with 
sequence column (#13847) (#13944)
9afd120c72 is described below

commit 9afd120c727732528b399cc488e2eab14343826a
Author: Xin Liao <liaoxin...@126.com>
AuthorDate: Thu Nov 3 19:00:34 2022 +0800

    [fix](sequence) fix that update table core dump with sequence column 
(#13847) (#13944)
---
 be/src/exec/olap_scanner.cpp     | 39 +++++++++++++++++++--------------------
 be/src/exec/olap_scanner.h       |  2 +-
 be/src/vec/olap/block_reader.cpp |  3 +--
 3 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/be/src/exec/olap_scanner.cpp b/be/src/exec/olap_scanner.cpp
index 47802cc6c0..413ebee301 100644
--- a/be/src/exec/olap_scanner.cpp
+++ b/be/src/exec/olap_scanner.cpp
@@ -155,7 +155,7 @@ Status OlapScanner::_init_tablet_reader_params(
 
     _tablet_reader_params.direct_mode = single_version || _aggregation;
 
-    RETURN_IF_ERROR(_init_return_columns(!_tablet_reader_params.direct_mode));
+    RETURN_IF_ERROR(_init_return_columns());
 
     _tablet_reader_params.tablet = _tablet;
     _tablet_reader_params.reader_type = READER_QUERY;
@@ -204,6 +204,23 @@ Status OlapScanner::_init_tablet_reader_params(
                 _tablet_reader_params.return_columns.push_back(index);
             }
         }
+
+        // expand the sequence column
+        if (_tablet->tablet_schema().has_sequence_col()) {
+            bool has_replace_col = false;
+            for (auto col : _return_columns) {
+                if (_tablet->tablet_schema().column(col).aggregation() ==
+                        
FieldAggregationMethod::OLAP_FIELD_AGGREGATION_REPLACE) {
+                    has_replace_col = true;
+                    break;
+                }
+            }
+            if (auto sequence_col_idx = 
_tablet->tablet_schema().sequence_col_idx();
+                    has_replace_col && std::find(_return_columns.begin(), 
_return_columns.end(),
+                        sequence_col_idx) == _return_columns.end()) {
+                
_tablet_reader_params.return_columns.push_back(sequence_col_idx);
+            }
+        }
     }
 
     // use _tablet_reader_params.return_columns, because reader use this to 
merge sort
@@ -227,7 +244,7 @@ Status OlapScanner::_init_tablet_reader_params(
     return Status::OK();
 }
 
-Status OlapScanner::_init_return_columns(bool need_seq_col) {
+Status OlapScanner::_init_return_columns() {
     for (auto slot : _tuple_desc->slots()) {
         if (!slot->is_materialized()) {
             continue;
@@ -244,24 +261,6 @@ Status OlapScanner::_init_return_columns(bool 
need_seq_col) {
             _tablet_columns_convert_to_null_set.emplace(index);
         _query_slots.push_back(slot);
     }
-
-    // expand the sequence column
-    if (_tablet->tablet_schema().has_sequence_col() && need_seq_col) {
-        bool has_replace_col = false;
-        for (auto col : _return_columns) {
-            if (_tablet->tablet_schema().column(col).aggregation() ==
-                FieldAggregationMethod::OLAP_FIELD_AGGREGATION_REPLACE) {
-                has_replace_col = true;
-                break;
-            }
-        }
-        if (auto sequence_col_idx = 
_tablet->tablet_schema().sequence_col_idx();
-            has_replace_col && std::find(_return_columns.begin(), 
_return_columns.end(),
-                                         sequence_col_idx) == 
_return_columns.end()) {
-            _return_columns.push_back(sequence_col_idx);
-        }
-    }
-
     if (_return_columns.empty()) {
         return Status::InternalError("failed to build storage scanner, no 
materialized slot!");
     }
diff --git a/be/src/exec/olap_scanner.h b/be/src/exec/olap_scanner.h
index 6be9c5c1aa..ce758365da 100644
--- a/be/src/exec/olap_scanner.h
+++ b/be/src/exec/olap_scanner.h
@@ -99,7 +99,7 @@ protected:
             const std::vector<OlapScanRange*>& key_ranges, const 
std::vector<TCondition>& filters,
             const std::vector<std::pair<string, 
std::shared_ptr<IBloomFilterFuncBase>>>&
                     bloom_filters);
-    Status _init_return_columns(bool need_seq_col);
+    Status _init_return_columns();
     void _convert_row_to_tuple(Tuple* tuple);
 
     // Update profile that need to be reported in realtime.
diff --git a/be/src/vec/olap/block_reader.cpp b/be/src/vec/olap/block_reader.cpp
index 19b1192444..bb59cad2cf 100644
--- a/be/src/vec/olap/block_reader.cpp
+++ b/be/src/vec/olap/block_reader.cpp
@@ -123,8 +123,7 @@ void BlockReader::_init_agg_state(const ReaderParams& 
read_params) {
 OLAPStatus BlockReader::init(const ReaderParams& read_params) {
     TabletReader::init(read_params);
 
-    auto return_column_size =
-            read_params.origin_return_columns->size() - (_sequence_col_idx != 
-1 ? 1 : 0);
+    auto return_column_size = read_params.origin_return_columns->size();
     _return_columns_loc.resize(read_params.return_columns.size());
     for (int i = 0; i < return_column_size; ++i) {
         auto cid = read_params.origin_return_columns->at(i);


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

Reply via email to