Skip to main content

Module predicate_bytecode

Module predicate_bytecode 

Source
Expand description

Predicate bytecode for TidyView::filter — Adaptive Engine v2.1.

Lowers a DExpr predicate to a flat stack-bytecode program once per filter() call, then interprets it in a tight loop. Produces bit- identical output to the legacy AST-walk path (try_eval_predicate_columnar) on every shape it accepts; lower returns None for unsupported shapes so the caller falls through to row-wise evaluation, exactly as before.

Why bytecode rather than recursive AST descent?

  • Lowering happens once. Interpretation is a flat loop over a Vec<PredicateOp> with no per-node recursion or Option-return error plumbing.
  • The supported predicate language is closed: leaves are always Col op Lit and interior nodes are always And/Or. Three opcodes are enough — no symbol table, no scopes.
  • Determinism is preserved by construction: every Cmp opcode delegates to the same columnar_cmp_* kernels the AST walk used. Floating-point semantics, NaN handling, and i64→f64 promotion all match bit-for-bit.

Structs§

PredicateBytecode

Enums§

CmpKind
LeafKind
One leaf comparison, fully resolved at lowering time.
PredicateOp

Functions§

should_use_sparse_path
Density rule for picking interpret_sparse over interpret.