Repository navigation
Adding a Jitexpr ValueSource to allow jitexpr in aggregations. - #3162
Conversation
8c855c4 to
1555344
Compare
021070f to
13782b2
Compare
f312825 to
ac9675e
Compare
7554754 to
d5630fd
Compare
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
d5630fd to
29f83cc
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d5630fdc38
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| [[example]] | ||
| name = "aggregation_jitexpr" | ||
| required-features = ["jitexpr"] |
There was a problem hiding this comment.
Add the declared example source file
The new [[example]] target has neither examples/aggregation_jitexpr.rs nor examples/aggregation_jitexpr/main.rs anywhere in the repository. Cargo therefore rejects the manifest before resolving or compiling any target (can't find aggregation_jitexpr example), so all Cargo build, test, and metadata commands fail even when the jitexpr feature is not enabled.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c5e5e15de7
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| VarType::Str => result | ||
| .as_str() | ||
| .map(|term: &str| term_dictionary.intern(term.as_bytes())), |
There was a problem hiding this comment.
Account computed string terms against the aggregation limit
When a string expression produces many distinct values, every result is retained in DynamicTermDictionary, but these allocations are never reported to AggregationLimitsGuard. This can bypass even a small configured memory limit—for example, a count aggregation over (UPPER unique_id) interns every transformed ID while the count collector itself uses constant memory—and may exhaust the process instead of returning MemoryExceeded. Track dictionary buffer, offsets, and hash-table growth against the request's aggregation guard, or avoid interning where the collector does not need term identities.
Useful? React with 👍 / 👎.
Adds
JitExprValueSourceProvider, aValueSourceProviderthat computes the values of a calculated field with a jitexpr expression over the fast fields of a segment. Registered in aValueSourceRegistry, a calculated field can be used by aggregations like a fast field.Builds on the
ValueSourceframework (#3160, #3171).Semantics
(ADD a 1i64)isi64on a segment whereaisi64, andf64where it isf64.DynamicTermDictionaryowned by the source. Their term ords are in first-seen order, not sorted with the terms.Terms aggregation restrictions
On computed sources:
min_doc_count: 0is rejected: we cannot list all the values a computed source could take._keyis rejected for text sources only (their ords are not sorted with the terms). Numeric and bool values use the monotonicu64mapping, so_keyordering works.include/excludeandmissingalready required a physical text column.ValueSourceDictionary::ords_sorted_with_termsis removed: the rule above replaces it.Implementation
InputColumn: a fast-field column bound to an input of the compiled function.TermResolver(term_resolver.rs): resolves the term ords of text inputs. Dictionaries with at most 1024 terms are decoded upfront. Larger ones are decoded on demand, with a bounded cache.JitExprValueSource::load_blockevaluates a block.eval_single_docevaluates one doc without the block buffers.JitExprValueSourceProvider::open_segmentreturns the concrete source (AlwaysNull/Constant/Variable).for_segmentwraps it.StrColumn::into_parts(columnar) splits a text column into its dictionary and its term ord column.JitExprPredicaterefactorJitExprPredicatenow builds its segment state withJitExprValueSourceProvider::open_segmentand evaluates docs witheval_single_doc. This removes the duplicated binding / compilation code. Text inputs now go throughTermResolverinstead of decoding the term of every doc. The necessary presence condition is built from the column indexes of the compiled inputs.Cargo
hashbrown, enabled by thejitexprfeature (term interning).jitexpris added to the default features.Tests
TermResolver: full decode, cached decode, eviction, single-ord path.eval_single_docmatchesload_block.