feat(core): RangeFilterExec — sorted-input per-partition range filter (purely additive) - #2262
Merged
Merged
Conversation
… (purely additive) Adds `RangeFilterExec`: filter that applies a per-input-partition half-open range predicate, widened by the operator's halo. Sibling of `PerPartitionFilterExec` (which handles arbitrary predicates); RFE specialises to `[lo, hi)` ranges over a `routing_expr` and gets a fast path for sorted inputs (binary-search slice + Arc-clone pass-through when a batch is entirely inside/outside the window). - Bounds are late-bound via `resolve_bounds`; wire encode refuses before resolution. Constructors: `try_new_pending`, `try_new_resolved`. - Halos + bounds use `ScalarValue` at the API + proto surface (generic over Arrow primitives); internal impl is Float64-only today and errors on non-Float64 until KLL widens support. - No in-tree callers — this is purely additive. - Includes serde roundtrip + fast/slow path unit tests. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
@phillipleblanc FYI |
DataType was only referenced textually in the test module (via `DataType::Float64` in schema builders); the non-test build treated the top-level import as unused, papered over by a `#[allow(dead_code)] fn _touch_datatype(_: DataType)`. Move the import into `mod tests` and remove the workaround. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
andygrove
reviewed
Aug 9, 2026
andygrove
approved these changes
Aug 9, 2026
andygrove
left a comment
Member
There was a problem hiding this comment.
Thanks @avantgardnerio. LGTM with a couple of nits.
…ignatures render as rustdoc links Both aliases were reachable only through structural spelling — `Vec<(Option<ScalarValue>, Option<ScalarValue>)>` for the raw form, `Vec<(Option<f64>, Option<f64>)>` for the widened form — because `range_filter` is a private module and neither alias was `pub`-re-exported. Rustdoc rendered `try_new_resolved` / `raw_bounds` / `widened_bounds` signatures with bare unlinkable names as a result. Bumping both to `pub` and re-exporting from `execution_plans` restores the signature → alias-page links. Addresses andygrove's review nits on apache#2262.
phillipleblanc
approved these changes
Aug 9, 2026
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
Extracted from #2223 (working parallel-windows acceleration PR).
Purely additive. Adds
RangeFilterExecalongsidePerPartitionFilterExec. No in-tree callers, no mutations. Follow-up PRs wire it into the parallel-window path.RangeFilterExecis the sorted-input specialisation ofPerPartitionFilterExec:[lo, hi)predicate per input partition, widened by a lower/upper halo (forRANGE-frame boundary context in bounded window ops).routing_exprascending: batch min/max bound the range, so batches entirely inside/outside the window skipfilter_record_batch—RecordBatch::slice(zero-copy) orArc-clone pass-through.filter_record_batchwhen the input isn't sorted or has nulls in the routing column.Design notes
resolve_bounds(). Wire encode refuses before resolution — over-the-wire plans always carry resolved bounds. Two constructors:try_new_pending(rule path — bounds resolved later by the scheduler) andtry_new_resolved(wire decode + task-restriction path).ScalarValueat the API + proto surface so future KLL migration to non-Float64 numeric primitives doesn't break callers. Internal impl is Float64-only today; errors loudly on other numeric types.Test plan
cargo test -p ballista-core --lib -- range_filter— 22 tests (fast/slow paths, halo widening, sorted-key detection, null handling, pending/resolved constructors, resolve validation)cargo test --workspace— 1200 pass / 0 fail / 8 ignoredcargo clippy --all-targetscleancargo fmt --all --checkcleanRUSTDOCFLAGS='-D warnings' cargo doc --workspace --no-depsclean