Skip to content

Add owned batch merging to T-Digest #269

Description

@tisonkun

Aggregation pipelines often own multiple partial TDigestMut states. Repeated borrowed merge calls recompress intermediate results, so consuming an iterator of digests should combine them with one compression pass while retaining the existing borrowed API.

PR #261 explored FromIterator<TDigestMut>. A first implementation collected sorted slices into a BinaryHeap and then collected all centroids again, which added allocations and obscured the data flow. The revised approach lazily k-way merges fully compressed sorted buffers directly into compression; inputs with unsorted update tails are materialized and stably sorted once because sorting every tail separately was slower.

A focused PR should cover empty and single inputs, mixed k values, stable tie ordering, compressed and uncompressed inputs, allocation-aware benchmarks, and the clone tradeoff between borrowed merge and consuming collection.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions