pub struct CompiledFilter { /* private fields */ }Expand description
A filter that has been compiled against a fixed column schema.
Cheap to clone (the op list is Vec<CompiledOp> and predicates
are already cloned at compile time).
Implementations§
Source§impl CompiledFilter
impl CompiledFilter
Sourcepub fn compile(
filter: &Filter,
schema: &HashMap<String, usize>,
) -> Result<Self, CompileError>
pub fn compile( filter: &Filter, schema: &HashMap<String, usize>, ) -> Result<Self, CompileError>
Compile a Filter against a column-name → slot-index map.
Returns CompileError::UnknownColumn when any predicate
references a column not in the schema.
Sourcepub fn op_count(&self) -> usize
pub fn op_count(&self) -> usize
Number of opcodes in the compiled program. Useful for tests and for diagnostics.
Sourcepub fn evaluate(&self, slot: &[Value]) -> bool
pub fn evaluate(&self, slot: &[Value]) -> bool
Evaluate the compiled filter against a row slot.
slot must be indexed by the same column-index map used at
compile time. Out-of-range indices are treated as
Value::Null (matching the legacy walker’s “column not
found” semantics).
Hot path — no allocation, no string lookup. The bool stack is
kept tiny (typical filter has ≤ 8 nesting levels) and lives
on the eval call’s local Vec.