Skip to content

Optimization: Avoid excessive decoding and allocation in exponential histogram last/first_over_time #138809

@JonasKunz

Description

@JonasKunz

Follow up issue for #138639 (comment).

For the implementation of first_over_time and last_over_time, we need to keep track of the currently "best" exponential_histogram. This is at the moment done by naively copying the histogram, causing both an allocation and a decoding of the histogram stored in the block.

We should optimize this by introducing something similar to a BreakingBytesRefBuilder, e.g. a resuable EncodedHistogramHolder:

  • It should internally use a BreakingBytesRefBuilder to store the histogram bytes and be reusable
  • It should be populateable from an ExponentialHistogram returned from a block without decoding: It should "see through" e.g. the CompressedHistogram´ and directly access and copy the underlying bytes[]`
  • It should be addable to an ExponentialHistogramBlockBuilder without requiring an encoding: The data should be directly copied instead

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Analytics/ES|QLAKA ESQLTeam:AnalyticsMeta label for analytical engine team (ESQL/Aggs/Geo)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions