-
Notifications
You must be signed in to change notification settings - Fork 80
feat(query): add dynamic expressions, zero-alloc DSL, and Schema-generic resolution #457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Key API: replace `Key::to_arrow_datum` with `Key::to_arrow_datums` to supportmulti-component keys; update all builtin `Key` impls (ints/floats/string/date/time/timestamp/dynamic `Value`) to return a single-element Vec for single-PK types. - Composite key showcase: add `Key2`/`Key2Ref` under `#[cfg(test)]` with `Encode`/`Decode`, `Ord`, `Hash`, `Key`/`KeyRef`; round-trip and ordering tests included. - Parquet scan filtering: implement lexicographic composite range predicates in`get_range_filter` using `eq/gt/gt_eq/lt/lt_eq` with `and_kleene`/`or_kleene`; retain `_ts` upper-bound predicate. - Scan plumbing: thread `pk_indices` through `SsTable::{get,scan}`, `Version::{query,streams,table_query}`, and `LevelStream`; update test callers. Build fixed projections as `[0, 1] ∪ pk_indices` in read paths. - Docs: update composite PK RFC with “Current Status (2025-08-11)”; add draft RFC “Replace Schema Trait with Arrow Schema”. - Clippy hygiene: remove needless range loops and redundant `.into_iter()`; add a focused `#[allow(clippy::too_many_arguments)]` on `Version::table_query`. BREAKING CHANGE: - `Key::to_arrow_datum` was replaced by `Key::to_arrow_datums(Vec<Arc<dyn Datum>>)`; external `Key` implementors must migrate to the new method (return one datum per PK component).
…ric resolution - Add `query` module with `dynamic.rs`, `expression.rs`, `error.rs`, and core `mod.rs`. - Dynamic AST: `ExprOwned`, `PredOwned`, `Selector`, `BoundOwned` with resolver to `ResolvedExpr`. - DSL predicates: `Eq`, `Range`, `Prefix` (upper-exclusive), `In`, `IsNull`, `IsNotNull`; logic: `And`, `Or`, `Not`. - Schema-generic APIs: `Expression::resolve<S: Schema>(&S)` and `ColumnSelector::resolve_col<S: Schema>(&S)`. - Selectors: `Col<'a>` (name) and `ColIndex<const I: usize>` (index) with Arrow `FieldRef` in `ResolvedSelector`. - Helpers: add `assert_value_type`, `derive_utf8_prefix_upper`, `derive_binary_prefix_upper`. - Value ergonomics: implement `From<T> for Value` for common scalars, strings, and binary (enables `Into<Value>` usage). - Crate root: expose `pub mod query` in `src/lib.rs`.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also note that we eventually want type coercion in the RFC
s | ||
} | ||
|
||
fn derive_binary_prefix_upper(prefix: &[u8]) -> Vec<u8> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theres a very minor edgecase where prefix + 0xFF + byte... will not be included.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we only support prefix matching on UTF8 encoding, it could be avoided.
query
module withdynamic.rs
,expression.rs
,error.rs
, and coremod.rs
.ExprOwned
,PredOwned
,Selector
,BoundOwned
with resolver toResolvedExpr
.Eq
,Range
,Prefix
(upper-exclusive),In
,IsNull
,IsNotNull
; logic:And
,Or
,Not
.Expression::resolve<S: Schema>(&S)
andColumnSelector::resolve_col<S: Schema>(&S)
.Col<'a>
(name) andColIndex<const I: usize>
(index) with ArrowFieldRef
inResolvedSelector
.assert_value_type
,derive_utf8_prefix_upper
,derive_binary_prefix_upper
.From<T> for Value
for common scalars, strings, and binary (enablesInto<Value>
usage).pub mod query
insrc/lib.rs
.