Skip to content

Commit

Permalink
Implement comment
Browse files Browse the repository at this point in the history
  • Loading branch information
aannleax committed Jul 5, 2024
1 parent fabbd84 commit efd21d8
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions nemo-physical/src/tabular/operations/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,20 @@ impl GeneratorFilter {

/// Helper function that finds the [OperationColumnMarker] used in the given [Filter]
/// that appears closest to the end of the given [OperationTable].
fn find_last_reference(table: &OperationTable, filter: &Filter) -> OperationColumnMarker {
///
/// Returns `None` if the given filter does not use any values as input.
fn find_last_reference(
table: &OperationTable,
filter: &Filter,
) -> Option<OperationColumnMarker> {
let references = filter.references();
for marker in table.iter().rev() {
if references.contains(marker) {
return *marker;
return Some(*marker);
}
}

// Compute constant columns in the first column
table[0]
None
}

/// Helper function that takes a list of boolean [Filter]s
Expand All @@ -140,7 +144,7 @@ impl GeneratorFilter {
let mut grouped_filters = HashMap::<OperationColumnMarker, Vec<&Filter>>::new();

for filter in filters {
let marker = Self::find_last_reference(input, filter);
let marker = Self::find_last_reference(input, filter).unwrap_or(input[0].clone());

Check failure on line 147 in nemo-physical/src/tabular/operations/filter.rs

View workflow job for this annotation

GitHub Actions / Lint with clippy

using `clone` on type `OperationColumnMarker` which implements the `Copy` trait
grouped_filters.entry(marker).or_default().push(filter);
}

Expand Down

0 comments on commit efd21d8

Please sign in to comment.