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


##########
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())) {

Review Comment:
   它之前是两个key schema的union,但是新的代码,似乎认为是upper 的key schema 会包含lower?感觉这两者之间没什么必然关系



-- 
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