Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 9 additions & 4 deletions nemo-physical/src/tabular/operations/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +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);
}
}

unreachable!("Filter must only use markers from the table.")
None
}

/// Helper function that takes a list of boolean [Filter]s
Expand All @@ -139,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]);
grouped_filters.entry(marker).or_default().push(filter);
}

Expand Down
1 change: 1 addition & 0 deletions nemo/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//! A fast in-memory rule engine

#![type_length_limit = "5000000000"]
#![deny(
missing_debug_implementations,
missing_copy_implementations,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
%%% Test related to
%%% https://github.com/knowsys/nemo/issues/500
%%%
%%% A panic was caused by having a filter consisting of constants

pair(1, 2) .
pair(3, 3) .

equal(?x) :- pair(?x, ?y), c = d .

@export equal :- csv {} .