Skip to main content

Module merge

Module merge 

Source
Expand description

Merge functions for distributed array query results.

Slice merges concatenate row sets from shards in arrival order and apply the coordinator-side limit. The output preserves each shard’s intra-shard order; cross-shard ordering reflects arrival, since the wire response (ArrayShardSliceResp::rows_msgpack) is a flat opaque Vec<Vec<u8>> with no per-row sort key. A globally Hilbert-ordered merge would require carrying a parallel prefix column on the wire and a k-way merge here — that is a wire-format change, not a merger change, and lives outside this module.

Aggregate merges combine per-shard partial aggregates using reducer-specific arithmetic (SUM/COUNT/MIN/MAX — same Welford technique as the timeseries merger).

Structs§

ArrayAggPartial
Partial aggregate contributed by a single shard for one group-by bucket.

Functions§

any_truncated_before_horizon_agg
Returns true if any shard reported that system_as_of fell below its oldest tile version, causing the shard to contribute zero partials.
any_truncated_before_horizon_slice
Returns true if any shard reported that system_as_of fell below its oldest tile version and it produced zero rows as a result.
merge_slice_rows
Merge row batches from multiple shards into one result set.
reduce_agg_partials
Merge per-shard partial aggregates into one result per group-by key.