3804 Commits
Author SHA1 Message Date
David Yaffe 1783018f9e Pin GitHub Actions runner images (#3153)
Replace floating runner labels with the images they resolve to today
(`ubuntu-latest` -> `ubuntu-24.04`), so OS upgrades happen in an explicit
change instead of whenever GitHub moves a `-latest` label. GitHub moves
`ubuntu-latest` to Ubuntu 26.04 between Oct 19 and Nov 19, 2026.
2026-10-05 16:19:24 -04:00
Paul MasurelandPaul Masurel 45bbb16542 Refactoring to make ValueSource::load_block take &mut self (#3147)
* Make ValueSource::load_block take &mut self

Value sources were held as `Arc<dyn ValueSource>` and cloned into their
collector, so `load_block` could only take `&self`. A computed source
could not keep per-segment state (caches, scratch buffers) across blocks.

Collectors were built in two phases: `build_nodes` pushed each
`XxxAggReqData` into per-kind vectors of `AggregationsSegmentCtx`, and
each collector builder cloned its request data out of those vectors by
index. The ctx copy had to stay around for name lookups, memory
accounting, and for the collectors that read their data back by index.

Each request node is turned into exactly one collector, so nothing
actually shares a value source. This change makes that ownership
explicit:

- `ValueSource::load_block` takes `&mut self`,
  `ValueSourceProvider::for_segment` returns `Box<dyn ValueSource>`.
- The request tree (`AggNode { data: AggNodeData, children }`) owns the
  request data. Building collectors consumes the tree, moving the
  request data into the collectors instead of cloning it.
- `AggregationsSegmentCtx` only keeps the shared collect-time state
  (context and block accessor). `PerRequestAggSegCtx`, `AggKind`,
  `idx_in_req_data` and the `push_*`/`get_*_req_data` helpers are gone.
- Cardinality, percentiles, top_hits and missing_term collectors own
  their request data instead of reading it from the ctx by index.
- Histogram requests are normalized once, when building the tree. The
  flattened terms x histogram path is split into a borrow-only plan step
  and a consuming build step, and no longer clones the histogram request
  at finalization.
- Request data memory is charged exactly once per node. Previously it
  was charged at every nesting level, and range, histogram, filter and
  composite builders charged their request data a second time.
- `FilterAggReqData::evaluator` no longer needs an `Rc`, and the
  filter, composite and multi_terms request data no longer derive Clone.

* CR comment

* CR comment

---------

Co-authored-by: Paul Masurel <paul.masurel@datadoghq.com>
2026-10-05 15:13:44 +02:00
Pascal Seitz 3db020e707 Clarify write position when tracking multivalued documents 2026-10-05 14:21:30 +02:00
Pascal Seitz 98fba246db Extract per-document sorting for deduplication 2026-10-05 14:21:30 +02:00
Pascal Seitz f18eb5df53 Use shared value fetching entry point for bucket collectors 2026-10-05 14:21:30 +02:00
Pascal Seitz 36884928c5 Cache block multivalued state during collection 2026-10-05 14:21:30 +02:00
Pascal Seitz 045b210e3b Deduplicate multivalued documents within histogram buckets 2026-10-05 14:21:30 +02:00
Pascal Seitz 7122be03e6 Deduplicate multivalued documents within range buckets 2026-10-05 14:21:30 +02:00
Pascal Seitz 8e5f1cef03 Document aggregation collector call contracts 2026-10-05 14:21:30 +02:00
François Massot 4abc20f924 Merge pull request #3143 from quickwit-oss/mallets/tiebreaker
feat: add generated tie-breaker fast fields
2026-10-02 10:58:50 +02:00
PSeitz-dd dcd4d4b6d2 Merge pull request #3144 from PSeitz/export-seek-danger-result
Export SeekDangerResult for downstream DocSet implementations
2026-10-02 10:07:10 +02:00
Luca Cominardi ef0bed7ea3 Simplify tie-breaker start bound and doc comment 2026-10-02 09:18:57 +02:00
Luca Cominardi 547524adbe fix: keep tiebreaker values u32-compatible for now 2026-10-02 09:08:06 +02:00
Pascal Seitz d69d570c7d Export SeekDangerResult for downstream DocSet implementations 2026-10-01 18:27:07 +02:00
Luca Cominardi a68b80ea94 Draw tie-breaker starts from the full u64 range 2026-10-01 16:25:38 +02:00
Luca Cominardi af3ad76251 Reject tie-breaker fields as index sort fields 2026-10-01 14:30:35 +02:00
Luca Cominardi 6a6378fa1f feat: add generated tie-breaker fast fields 2026-10-01 14:24:04 +02:00
Luca Cominardi a102eed940 Merge remote-tracking branch 'origin/main' into mallets/seqnum-field 2026-10-01 11:40:33 +02:00
Paul MasurelandPaul Masurel 1f9e49da6b Abstracting columnar from aggregation. (#3112)
* Changing the way aggregation access their value.

They now get values via a ValueSource abstraction.
The aggregation collector also gets the possibility to
register ValueSourceProvider describing value columns that are computed
on the fly.

Finally, segment aggregation that require a full column
now manipulates a Arc<dyn ColumnValue> directly.

* CR comments

* Clippy

* Fixing regression

---------

Co-authored-by: Paul Masurel <paul.masurel@datadoghq.com>
2026-09-30 19:12:20 +02:00
Walter Woodall d5e2842575 fix: stream positions during sorted segment merges (#3116)
Sorted segment merges copied every document's positions for a term into a vector before sorting by mapped document ID. Common terms with many positions therefore consumed memory proportional to documents × positions, outside the indexing writer budget.

Stream shuffled postings through a min-heap with one cursor per input segment and one reusable positions buffer. The mapping preserves each segment's document order; deleted/filtered postings are skipped. The stacked path continues to stream directly.
2026-09-29 16:55:20 -07:00
trinity-1686a 3b5ab82e20 Merge pull request #3126 from quickwit-oss/trinity.pointard/sstable-perf
improve Streamer::advance perf
2026-09-29 12:12:03 +02:00
trinity-1686a 171340677f address cr 2026-09-29 12:04:38 +02:00
palmoni5 637803de99 Add RegexPhraseQuery::from_regexes (#3138)
RegexQuery can be built from a compiled Regex, but RegexPhraseQuery always compiled its patterns with Regex::new and its default DFA state limit. from_regexes takes the compiled regexes directly, so a caller can build them with its own limits, or reuse ones it already compiled.
2026-09-29 11:45:00 +02:00
palmoni5 9e1b0de23a Expose the Levenshtein automaton of FuzzyTermQuery (#3136)
* Expose the Levenshtein automaton of FuzzyTermQuery

Callers that need the terms a fuzzy query expands to (e.g. to highlight them) had to copy the private DfaWrapper and depend on the same levenshtein_automata version as tantivy, or their expansion could silently diverge from the query's. FuzzyTermQuery::automaton returns the automaton the query matches with, built from the same cached LevenshteinAutomatonBuilder.

* Export DfaWrapper outside of tests

The re-export was still behind #[cfg(test)], so FuzzyTermQuery::automaton returned a type other crates could not name. A doctest now uses it from outside the crate.
2026-09-29 09:50:24 +02:00
omerb-vega 93280f56fb Map multivalued doc ranks to doc ids with a select cursor (#3133)
* columnar: bench row id to doc id conversion on multivalued columns

* columnar: map multivalued doc ranks to doc ids with a select cursor

MultiValueIndexV2::select_batch_in_place ended with one
OptionalIndex::select call per matched doc, each locating its block from
scratch. The ranks are sorted and deduplicated at that point, so
OptionalIndex::select_batch converts them in one sequential pass with a
select cursor.

Every Column::get_docids_for_value_range call on a multivalued column goes
through here, e.g. fast field range queries.
2026-09-29 09:31:00 +02:00
palmoni5 88a17da8e9 Expose the fragment byte range on Snippet (#3134)
Snippet only kept a copy of the fragment text, so callers that need to extend the fragment or map it back to the source (e.g. to keep punctuation that the tokenizer leaves outside the last token) had to search for it, which picks the wrong occurrence when the same text appears earlier.
2026-09-29 09:28:29 +02:00
palmoni5 1d294ea6dc Cache RegexPhraseQuery's compiled regexes in the query (#3137)
Following up on #3135, the regexes are compiled on first use and kept in the query, so a query reused across searchers, or cloned, determinizes each pattern once. RegexPhraseQuery::regexes exposes them for callers that inspect the patterns before searching, e.g. to count a phrase's per-segment expansions against max_expansions, instead of compiling them a second time.
2026-09-29 09:19:07 +02:00
Paul MasurelandPaul Masurel 047464cf92 Accelerating jitexpr conditions using necessary conditions (#3129)
* jitexpr

* Added possible necessary conditions to jitexpr.

A function makes it possible to infer a necessary query from an expression to match.
We can then accelerate queries involving a calculated field by not even evaluating the expression
on docs that trivially do not match.

* CR comment

* CR comment

* Fixing unit tests

---------

Co-authored-by: Paul Masurel <paul.masurel@datadoghq.com>
2026-09-28 18:46:37 +02:00
palmoni5 b9125aad55 Compile RegexPhraseQuery regexes once per weight (#3135)
RegexPhraseWeight::phrase_scorer compiled every phrase term's regex again for each segment. Determinizing a wide pattern (e.g. an alternation of typo or morphology expansions) costs milliseconds to tens of milliseconds, so on a multi-segment index the query was dominated by recompiling the same automata. The regexes are now compiled in RegexPhraseQuery::regex_phrase_weight and shared through Arc.

An invalid pattern is now reported when the weight is built, instead of when the first segment is scored.
2026-09-28 11:37:50 +02:00
trinity-1686a 6c311b311d use will_always_match hint 2026-09-24 19:09:25 +02:00
trinity-1686a 2bb52f1460 hide some branches behind const generics 2026-09-24 18:46:21 +02:00
trinity-1686a bec1b08bdf use delta-based prefix matcher
it does less slice comparisons overall, which improves throughput
2026-09-24 18:46:21 +02:00
trinity-1686a aac95014b3 remove lower_bound check from streamer hotloop 2026-09-24 18:46:21 +02:00
trinity-1686a 95dfcd3ada add bench for automaton sstable streaming 2026-09-24 18:46:15 +02:00
David Yaffe 6182c6062f Merge pull request #3084 from quickwit-oss/dependabot/cargo/datasketches-0.5.0
Update datasketches requirement from 0.3.0 to 0.5.0
2026-09-23 15:53:13 -04:00
dayaffe 53e90ab192 Merge main into datasketches 0.5 update 2026-09-23 18:39:37 +00:00
Pascal Seitz 08d5836b8f Format with nightly rustfmt 2026-09-23 20:21:08 +08:00
Pascal Seitz c321b170a8 Clarify chunk size and packed value type in bit unpacking fast path 2026-09-23 20:21:08 +08:00
Pascal Seitz 6023163e37 Extract bit unpacking load helper with explicit safety contract
Replace the closure with an inline(always) function taking the data
slice and bit address, making its inputs and safety requirements explicit.
2026-09-23 20:21:08 +08:00
PSeitzandPaul Masurel f5fb40950a Update bitpacker/src/bitpacker.rs
Co-authored-by: Paul Masurel <paul@quickwit.io>
2026-09-23 20:21:08 +08:00
Pascal Seitz 21a6913217 Simplify bitpacked range decoding
Use scalar decoding for ranges overlapping the final partial load.
Clarify the 64-value aggregation block specialization and name the
generic decoding chunk size.

Apply nightly formatting to the touched benchmark and columnar code.
2026-09-23 20:21:08 +08:00
Pascal Seitz 4ede8d64f2 Optimize low-bit-width block decoding
Decode eight values per load for 64-value blocks and specialize bit
widths 1 through 7 to enable constant folding in the hot path.
2026-09-23 20:21:08 +08:00
Pascal Seitz 4a660f59d2 Faster columnar data fetching 2026-09-23 20:21:08 +08:00
Pascal Seitz be8a1d0986 Add 26-bit date histogram aggregation benchmark 2026-09-23 20:21:08 +08:00
Pascal Seitz e229de6db7 Collect decoded multi-term keys before assigning bucket positions 2026-09-22 19:53:52 +08:00
Pascal Seitz 7d3a3d6bfe Use unwrap_or(false) for missing bucket value check 2026-09-22 19:53:52 +08:00
Pascal Seitz 62f3d4b4dd Apply multi-terms cutoff before final bucket conversion
Avoid formatting keys and finalizing sub-aggregations for buckets
discarded by the final size limit. Preallocate the retained bucket vector
and reuse the cutoff helper with intermediate tuple keys.

Preserve final-key ordering and finalize the ordering metric when sorting
by a sub-aggregation. Cover mixed key types, empty sums, and discarded
document counts in tests.
2026-09-22 19:53:52 +08:00
Pascal Seitz 3655e6f8cb Batch multi-terms dictionary lookups after pruning
Resolve retained string ordinals in sorted batches per field instead
of decoding dictionary blocks separately for each tuple component.
Reuse decoding for repeated ordinals while preserving tuple order
and existing numeric and missing-value handling.
2026-09-22 19:53:52 +08:00
Pascal Seitz 085a8327d3 Merge incoming aggregation buckets into the accumulator
Probe the accumulated map only for incoming keys rather than rehashing every accumulated key on each merge. This removes quadratic work when folding many disjoint multi-terms results. The same helper serves range and composite buckets; existing bucket values still merge left-to-right and the wire representation and pruning rules are unchanged.

Cover overlapping/disjoint tuple keys, empty inputs, recursive range subaggregations, postcard round trips, error/count bookkeeping, and merging after pruning.

Same benchmark and configuration as 0062d2f0d (Apple M4 Max, rustc 1.98.0):
Median milliseconds for 10 / 100 / 1000 inputs:
shared 8:     0.006365 / 0.0656 / 0.6449
disjoint 16:  0.0126   / 0.1486 / 1.6882
disjoint 160: 0.1336   / 1.5558 / 20.4019
At 1000 inputs this is 52.4x and 61.6x faster for the disjoint cases, with unchanged measured peak allocation. Shared-key control remains within approximately 2% of baseline.

Validation: 308 aggregation tests pass with default features and 308 with quickwit; changed-file rustfmt and git diff checks pass. Clippy --lib --bench agg_bench passes with the pre-existing clippy::drop_non_drop warning allowed (unchanged drop(add_document) in the benchmark).
2026-09-22 19:53:52 +08:00
Pascal Seitz 0f512fc3e2 Benchmark multi-terms aggregations across many segments
Run the existing many-segment aggregation benchmarks at 100 and 1,000
segments with one million total documents. Add multi-terms and nested
terms cases for status/Zipf and high-cardinality/Zipf combinations,
including top-500 requests, to expose merge costs across many segments.

The nested top-500 case limits outer buckets, while multi-terms limits
tuples globally.

Run both groups with: cargo bench --bench agg_bench -- _segments
2026-09-22 19:53:52 +08:00