yiguolei commented on code in PR #66472:
URL: https://github.com/apache/doris/pull/66472#discussion_r3765312598


##########
be/src/storage/segment/segment_iterator.cpp:
##########
@@ -751,63 +736,56 @@ Status SegmentIterator::_get_row_ranges_by_keys() {
 
 // Set up environment for the following seek.
 Status SegmentIterator::_prepare_seek(const StorageReadOptions::KeyRange& 
key_range) {
-    std::vector<const TabletColumn*> key_columns;
-    std::set<uint32_t> column_set;
-    if (key_range.lower_key != nullptr) {
-        for (auto cid : key_range.lower_key->schema()->column_ids()) {
-            column_set.emplace(cid);
-            key_columns.emplace_back(key_range.lower_key->column(cid));
-        }
-    }
-    if (key_range.upper_key != nullptr) {
-        for (auto cid : key_range.upper_key->schema()->column_ids()) {
-            if (column_set.count(cid) == 0) {
-                key_columns.emplace_back(key_range.upper_key->column(cid));
-                column_set.emplace(cid);
-            }
-        }
+    // Both bound keys carry a dense prefix of the tablet key columns,
+    const doris::ReadSchema* key_schema =
+            key_range.lower_key != nullptr ? key_range.lower_key->schema() : 
nullptr;
+    if (key_range.upper_key != nullptr &&
+        (key_schema == nullptr ||
+         key_range.upper_key->schema()->num_read_columns() > 
key_schema->num_read_columns())) {
+        key_schema = key_range.upper_key->schema();
+    }
+    if (key_schema == nullptr) {
+        return Status::OK();
     }
     if (!_seek_schema) {

Review Comment:
   如果这里认为肯定相等,我们就得加一些检查,防止我们这种假定可能不对,包括之前的lower key的schema和upper key的schema的问题



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to