yiguolei commented on code in PR #66472:
URL: https://github.com/apache/doris/pull/66472#discussion_r3765298040
##########
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:
这个代码也很诡异,难道多个key range的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]