Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions parquet/src/arrow/arrow_reader/read_plan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,22 @@ impl ReadPlanBuilder {
None => return RowSelectionStrategy::Selectors,
};

let trimmed = selection.clone().trim();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this clone shows up in the traces for some of the clickbench queries. I think this is because there are 9000 selectors for these queries

let selectors: Vec<RowSelector> = trimmed.into();
if selectors.is_empty() {
return RowSelectionStrategy::Mask;
}

let total_rows: usize = selectors.iter().map(|s| s.row_count).sum();
let selector_count = selectors.len();
if selector_count == 0 {
// total_rows: total number of rows selected / skipped
// effective_count: number of non-empty selectors
let (total_rows, effective_count) =
selection.iter().fold((0usize, 0usize), |(rows, count), s| {
if s.row_count > 0 {
(rows + s.row_count, count + 1)
} else {
(rows, count)
}
});

if effective_count == 0 {
return RowSelectionStrategy::Mask;
}

if total_rows < selector_count.saturating_mul(threshold) {
if total_rows < effective_count.saturating_mul(threshold) {
RowSelectionStrategy::Mask
} else {
RowSelectionStrategy::Selectors
Expand Down
Loading