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 15b9830859 [fix](partial-update) sequence column is not proceeded 
correctly #20813
15b9830859 is described below

commit 15b9830859b2e6541dc9cd41e99965c51808af5e
Author: zhannngchen <48427519+zhannngc...@users.noreply.github.com>
AuthorDate: Thu Jun 15 14:07:00 2023 +0800

    [fix](partial-update) sequence column is not proceeded correctly #20813
    
    When checking the keys in PrimaryKeyIndex, seq_col_length is not set to 
correct value, then we got a NOT_FOUND result for an existing key.
---
 be/src/olap/rowset/segment_v2/segment.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/be/src/olap/rowset/segment_v2/segment.cpp 
b/be/src/olap/rowset/segment_v2/segment.cpp
index e81b71eeed..527f8391cc 100644
--- a/be/src/olap/rowset/segment_v2/segment.cpp
+++ b/be/src/olap/rowset/segment_v2/segment.cpp
@@ -358,10 +358,12 @@ Status Segment::lookup_row_key(const Slice& key, bool 
with_seq_col, RowLocation*
     RETURN_IF_ERROR(load_pk_index_and_bf());
     bool has_seq_col = _tablet_schema->has_sequence_col();
     size_t seq_col_length = 0;
-    if (has_seq_col && with_seq_col) {
+    if (has_seq_col) {
         seq_col_length = 
_tablet_schema->column(_tablet_schema->sequence_col_idx()).length() + 1;
     }
-    Slice key_without_seq = Slice(key.get_data(), key.get_size() - 
seq_col_length);
+
+    Slice key_without_seq =
+            Slice(key.get_data(), key.get_size() - (with_seq_col ? 
seq_col_length : 0));
 
     DCHECK(_pk_index_reader != nullptr);
     if (!_pk_index_reader->check_present(key_without_seq)) {
@@ -396,6 +398,10 @@ Status Segment::lookup_row_key(const Slice& key, bool 
with_seq_col, RowLocation*
             return Status::NotFound("Can't find key in the segment");
         }
 
+        if (!with_seq_col) {
+            return Status::OK();
+        }
+
         // compare sequence id
         Slice sequence_id =
                 Slice(key.get_data() + key_without_seq.get_size() + 1, 
seq_col_length - 1);


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

Reply via email to