github-actions[bot] commented on code in PR #24972:
URL: https://github.com/apache/doris/pull/24972#discussion_r1338369499
##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -1762,6 +1830,82 @@ Status
SegmentIterator::_read_columns_by_rowids(std::vector<ColumnId>& read_colu
return Status::OK();
}
+Status SegmentIterator::_handle_late_arrival_predicates() {
+ if (_opts.late_arrival_predicates == nullptr) {
+ return Status::OK();
+ }
+
+ if (_row_bitmap.isEmpty()) {
+ return Status::OK();
+ }
+
+ const auto count = _opts.late_arrival_predicates->size();
+
+ if (_handled_late_predicates_count == count) {
+ return Status::OK();
+ }
+
+ RowRanges condition_row_ranges =
RowRanges::create_single(_segment->num_rows());
+
+ std::unordered_map<int32_t, std::shared_ptr<AndBlockColumnPredicate>>
col_id_to_predicates;
+
+ std::vector<int> columns_id;
Review Comment:
warning: variable 'columns_id' is not initialized
[cppcoreguidelines-init-variables]
```suggestion
std::vector<int> columns_id = 0;
```
##########
be/src/olap/reader.cpp:
##########
@@ -683,4 +686,19 @@ Status TabletReader::init_reader_params_and_create_block(
return Status::OK();
}
+Status TabletReader::push_late_arrival_runtime_filter(const IRuntimeFilter*
filter,
+ const SlotDescriptor*
slot_descriptor) {
+ RETURN_IF_ERROR(_tablet_schema->have_column(slot_descriptor->col_name()));
+ auto column = _tablet_schema->column(slot_descriptor->col_name());
+ auto column_index =
_tablet_schema->field_index(slot_descriptor->col_name());
+ std::vector<ColumnPredicate*> predicates;
Review Comment:
warning: variable 'predicates' is not initialized
[cppcoreguidelines-init-variables]
```suggestion
std::vector<ColumnPredicate*> predicates = 0;
```
##########
be/src/olap/rowset/segment_v2/segment_iterator.cpp:
##########
@@ -1762,6 +1830,82 @@ Status
SegmentIterator::_read_columns_by_rowids(std::vector<ColumnId>& read_colu
return Status::OK();
}
+Status SegmentIterator::_handle_late_arrival_predicates() {
+ if (_opts.late_arrival_predicates == nullptr) {
+ return Status::OK();
+ }
+
+ if (_row_bitmap.isEmpty()) {
+ return Status::OK();
+ }
+
+ const auto count = _opts.late_arrival_predicates->size();
+
+ if (_handled_late_predicates_count == count) {
+ return Status::OK();
+ }
+
+ RowRanges condition_row_ranges =
RowRanges::create_single(_segment->num_rows());
+
+ std::unordered_map<int32_t, std::shared_ptr<AndBlockColumnPredicate>>
col_id_to_predicates;
+
+ std::vector<int> columns_id;
+ for (size_t i = _handled_late_predicates_count; i != count; ++i) {
+ auto predicate = _opts.late_arrival_predicates->at(i);
+ const auto column_id = predicate->column_id();
+ if (col_id_to_predicates.count(column_id) == 0) {
+ columns_id.emplace_back(column_id);
+ col_id_to_predicates.insert({column_id,
std::make_shared<AndBlockColumnPredicate>()});
+ }
+ col_id_to_predicates[column_id]->add_column_predicate(
+ new SingleColumnBlockPredicate(predicate));
+ }
+
+ _handled_late_predicates_count = count;
+
+ RowRanges bf_row_ranges = RowRanges::create_single(num_rows());
+ for (auto& cid : columns_id) {
+ // get row ranges by bf index of this column,
+ RowRanges column_bf_row_ranges = RowRanges::create_single(num_rows());
+ DCHECK(col_id_to_predicates.count(cid) > 0);
+ RETURN_IF_ERROR(_column_iterators[cid]->get_row_ranges_by_bloom_filter(
+ col_id_to_predicates.at(cid).get(), &column_bf_row_ranges));
+ RowRanges::ranges_intersection(bf_row_ranges, column_bf_row_ranges,
&bf_row_ranges);
+ }
+
+ RowRanges zone_map_row_ranges = RowRanges::create_single(num_rows());
+ // second filter data by zone map
+ for (auto& cid : columns_id) {
+ // get row ranges by zone map of this column,
+ RowRanges column_row_ranges = RowRanges::create_single(num_rows());
+ DCHECK(col_id_to_predicates.count(cid) > 0);
+ RETURN_IF_ERROR(_column_iterators[cid]->get_row_ranges_by_zone_map(
+ col_id_to_predicates.at(cid).get(), nullptr,
&column_row_ranges));
+ // intersect different columns' row ranges to get final row ranges by
zone map
+ RowRanges::ranges_intersection(zone_map_row_ranges, column_row_ranges,
+ &zone_map_row_ranges);
+ }
+
+ RowRanges::ranges_intersection(bf_row_ranges, zone_map_row_ranges,
&condition_row_ranges);
+ size_t pre_size = _row_bitmap.cardinality();
Review Comment:
warning: variable 'pre_size' is not initialized
[cppcoreguidelines-init-variables]
```suggestion
size_t pre_size = 0 = _row_bitmap.cardinality();
```
##########
be/src/vec/exec/scan/vscanner.cpp:
##########
@@ -169,10 +170,30 @@ Status VScanner::try_append_late_arrival_runtime_filter()
{
} else {
RETURN_IF_ERROR(_local_state->clone_conjunct_ctxs(_conjuncts));
}
+ RETURN_IF_ERROR(_push_late_arrival_runtime_filters());
_applied_rf_num = arrived_rf_num;
return Status::OK();
}
+Status VScanner::_push_late_arrival_runtime_filters() {
+ std::set<int32_t> pushed_id;
Review Comment:
warning: variable 'pushed_id' is not initialized
[cppcoreguidelines-init-variables]
```suggestion
std::set<int32_t> pushed_id = 0;
```
--
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]