gaodayue commented on a change in pull request #1704: support multiple key
ranges in RowwiseIterator and StorageReadOptions
URL: https://github.com/apache/incubator-doris/pull/1704#discussion_r317922042
##########
File path: be/src/olap/rowset/segment_v2/segment_iterator.cpp
##########
@@ -47,72 +49,67 @@ SegmentIterator::~SegmentIterator() {
}
}
-Status SegmentIterator::init(const StorageReadOptions& opts) {
+Status SegmentIterator::_init() {
DorisMetrics::segment_read_total.increment(1);
- _opts = opts;
- RETURN_IF_ERROR(_init_short_key_range());
- RETURN_IF_ERROR(_init_row_ranges());
+ RETURN_IF_ERROR(_get_row_ranges_by_keys());
+ RETURN_IF_ERROR(_get_row_ranges_by_column_conditions());
if (!_row_ranges.is_empty()) {
_cur_range_id = 0;
_cur_rowid = _row_ranges.get_range_from(_cur_range_id);
}
RETURN_IF_ERROR(_init_column_iterators());
-
return Status::OK();
}
-// This function will use input key bounds to get a row range.
-Status SegmentIterator::_init_short_key_range() {
+Status SegmentIterator::_get_row_ranges_by_keys() {
DorisMetrics::segment_row_total.increment(num_rows());
- _lower_rowid = 0;
- _upper_rowid = num_rows();
- // initial short key row ranges: [0, num_rows())
- _row_ranges = RowRanges::create_single(_lower_rowid, _upper_rowid);
-
- // fast path for empty segment
- if (_upper_rowid == 0) {
- return Status::OK();
- }
- if (_opts.lower_bound == nullptr && _opts.upper_bound == nullptr) {
+ // fast path for empty segment or empty key ranges
+ if (_row_ranges.is_empty() || _opts.key_ranges().empty()) {
return Status::OK();
}
- RETURN_IF_ERROR(_prepare_seek());
-
- // init row range with short key range
- if (_opts.upper_bound != nullptr) {
- // If client want to read upper_bound, the include_upper_bound is
true. So we
- // should get the first ordinal at which key is larger than
upper_bound.
- // So we call _lookup_ordinal with include_upper_bound's negate
- RETURN_IF_ERROR(_lookup_ordinal(
- *_opts.upper_bound, !_opts.include_upper_bound, num_rows(),
&_upper_rowid));
- }
- if (_upper_rowid > 0 && _opts.lower_bound != nullptr) {
- RETURN_IF_ERROR(_lookup_ordinal(
- *_opts.lower_bound, _opts.include_lower_bound, _upper_rowid,
&_lower_rowid));
+ rowid_t lower_rowid = 0;
Review comment:
ok
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]