feat: add filter expression storage to query arena#8
Merged
Conversation
aad80df to
7603726
Compare
… plan() refactor: make FilterEvaluator self-describing with slots() and unify plan() FilterEvaluator now requires a slots() method declaring which filter slots the evaluator handles. plan() queries the evaluator's slots and wraps the plan with ExternalFilter nodes. This eliminates the separate plan_filtered() method and ensures search() always applies filters correctly. Addresses PR review feedback: the old search(filter) API silently ignored the filter because plan() never attached ExternalFilter nodes. fix: address review findings — AcceptAll test gap and plan/execute mismatch guard - Give AcceptAll test filter a slot so evaluate() is actually dispatched through the ExternalFilter node path - Add debug_assert in try_execute_root and try_execute_root_unscored that filter.slots() is empty when the Term fast path fires, catching plan/execute filter mismatches in debug builds fix: broken intra-doc link for ExternalFilter in leit_core
7603726 to
4fbb37c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
FilterSlotId,FilterEvaluator<Id: EntityId>trait, andNoFiltertoleit_coreFilterPredicate,FilterValueenums andQueryNode::Filter/ExternalFiltervariants toleit_queryExecutionPlan::wrap_external_filter()for post-planning filter attachmentFilterEvaluator<u32>throughExecutionWorkspace::{execute, search}and all internal execution methodsExecutionWorkspace::plan_filtered()as primary API for attaching filters to string queriesExternalFilternodes are immediately usable;Filter(structured predicates) returnsIndexError::UnsupportedFilterPredicateuntil columnar storage (Phase 3)Design
Filtering is node-mediated:
ExternalFilternodes in the query plan dispatch to theFilterEvaluatorat execution time.NoFilteris a zero-cost abstraction — the compiler eliminates all filter checks via monomorphization. TheFilterEvaluatortrait is generic overId: EntityIdinleit_coreto avoid a future breaking change when the pipeline becomes generic.Spec:
docs/superpowers/specs/2026-04-05-filter-expression-storage-design.mdTest plan
Filter/ExternalFiltervalidation,children(),FilterPredicatecombinatorswrap_external_filtermetadata (root, depth, cost, selectivity, features)&NoFilterparametercargo clippy --workspace --all-features --all-targetscleancargo test --workspace --all-features— 177 tests pass