liaoxin01 commented on code in PR #11808:
URL: https://github.com/apache/doris/pull/11808#discussion_r946666035


##########
be/src/olap/rowset/segment_v2/segment.cpp:
##########
@@ -245,19 +245,59 @@ Status Segment::new_bitmap_index_iterator(const 
TabletColumn& tablet_column,
 
 Status Segment::lookup_row_key(const Slice& key, RowLocation* row_location) {
     RETURN_IF_ERROR(load_index());
+    bool has_seq_col = _tablet_schema->has_sequence_col();
+    size_t seq_col_length = 0;
+    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);
+
     DCHECK(_pk_index_reader != nullptr);
-    if (!_pk_index_reader->check_present(key)) {
+    if (!_pk_index_reader->check_present(key_without_seq)) {
         return Status::NotFound("Can't find key in the segment");
     }
     bool exact_match = false;
     std::unique_ptr<segment_v2::IndexedColumnIterator> index_iterator;
     RETURN_IF_ERROR(_pk_index_reader->new_iterator(&index_iterator));
-    RETURN_IF_ERROR(index_iterator->seek_at_or_after(&key, &exact_match));
-    if (!exact_match) {
+    RETURN_IF_ERROR(index_iterator->seek_at_or_after(&key_without_seq, 
&exact_match));
+    if (!has_seq_col && !exact_match) {
         return Status::NotFound("Can't find key in the segment");
     }
     row_location->row_id = index_iterator->get_current_ordinal();
     row_location->segment_id = _segment_id;
+
+    if (has_seq_col) {
+        MemPool pool;
+        size_t num_to_read = 1;
+        std::unique_ptr<ColumnVectorBatch> cvb;
+        RETURN_IF_ERROR(ColumnVectorBatch::create(num_to_read, false, 
_pk_index_reader->type_info(),
+                                                  nullptr, &cvb));
+        ColumnBlock block(cvb.get(), &pool);
+        ColumnBlockView column_block_view(&block);
+        size_t num_read = num_to_read;
+        RETURN_IF_ERROR(index_iterator->next_batch(&num_read, 
&column_block_view));
+        DCHECK(num_to_read == num_read);
+
+        const Slice* previous_key = reinterpret_cast<const 
Slice*>(cvb->cell_ptr(0));

Review Comment:
   fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to