Skip to main content

Module merge

Module merge 

Source
Expand description

Merge functions for distributed array query results.

Plain slice merges (merge_slice_rows) concatenate row sets from shards in arrival order and apply the coordinator-side limit, preserving each shard’s intra-shard order. Cross-shard ordering reflects arrival, since a plain slice row carries 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.

Audit-log slice merges (merge_slice_rows_sorted) do carry a sort key: each native-msgpack row holds a _ts_system column, so these are merged globally by system-time ascending before the limit is applied.

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.
merge_slice_rows_sorted
Merge row batches from multiple shards for an audit-log (AllVersions) fan-out.
reduce_agg_partials
Merge per-shard partial aggregates into one result per group-by key.