morningman commented on a change in pull request #3943:
URL: https://github.com/apache/incubator-doris/pull/3943#discussion_r446474144



##########
File path: be/src/olap/rowset/segment_v2/segment_iterator.cpp
##########
@@ -253,30 +253,37 @@ Status 
SegmentIterator::_get_row_ranges_from_conditions(RowRanges* condition_row
     _opts.stats->rows_bf_filtered += (pre_size - 
condition_row_ranges->count());
 
     RowRanges zone_map_row_ranges = RowRanges::create_single(num_rows());
-    std::map<int, std::vector<CondColumn*>> column_delete_conditions;
-    // zone map will use delete conditions
-    for (auto& delete_condition : _opts.delete_conditions) {
-        for (auto& column_condition : delete_condition->columns()) {
-            cids.insert(column_condition.first);
-            std::vector<CondColumn*>& conditions = 
column_delete_conditions[column_condition.first];
-            conditions.emplace_back(column_condition.second);
-        }
-    }
+    // second filter data by zone map
     for (auto& cid : cids) {
         // get row ranges by zone map of this column,
         RowRanges column_row_ranges = RowRanges::create_single(num_rows());
-        CondColumn* column_cond = nullptr;
-        if (_opts.conditions != nullptr) {
-            column_cond = _opts.conditions->get_column(cid);
-        }
+        CondColumn* column_cond = _opts.conditions->get_column(cid);
         RETURN_IF_ERROR(
-            _column_iterators[cid]->get_row_ranges_by_zone_map(
-                column_cond,
-                column_delete_conditions[cid],
-                &column_row_ranges));
-        // intersection different columns's row ranges to get final row ranges 
by zone map
+                _column_iterators[cid]->get_row_ranges_by_zone_map(
+                        column_cond,
+                        nullptr,
+                        &column_row_ranges));
+        // intersect different columns's row ranges to get final row ranges by 
zone map
         RowRanges::ranges_intersection(zone_map_row_ranges, column_row_ranges, 
&zone_map_row_ranges);
     }
+
+    // final filter data with delete conditions
+    for (auto& delete_condition : _opts.delete_conditions) {
+        RowRanges delete_condition_row_ranges = RowRanges::create_single(0);
+        for (auto& delete_column_condition : delete_condition->columns()) {
+            const int32_t cid = delete_column_condition.first;
+            CondColumn* column_cond = _opts.conditions->get_column(cid);
+            RowRanges single_delete_condition_row_ranges = 
RowRanges::create_single(num_rows());
+            RETURN_IF_ERROR(
+                    _column_iterators[cid]->get_row_ranges_by_zone_map(
+                            column_cond,

Review comment:
       Should the `column_cond` be null here?
   We already filter the data by column conditions before.




----------------------------------------------------------------
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:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to