Class BytesRefBucketedSort

java.lang.Object
org.elasticsearch.compute.data.sort.BytesRefBucketedSort
All Implemented Interfaces:
Closeable, AutoCloseable, org.elasticsearch.core.Releasable

public class BytesRefBucketedSort extends Object implements org.elasticsearch.core.Releasable
Aggregates the top N variable length BytesRef values per bucket. See BucketedSort for more information.

This is substantially different from IpBucketedSort because this has to handle variable length byte strings. To do that it allocates a heap of BreakingBytesRefBuilders.

  • Constructor Details

  • Method Details

    • collect

      public void collect(org.apache.lucene.util.BytesRef value, int bucket)
      Collects a value into a bucket.

      It may or may not be inserted in the heap, depending on if it is better than the current root.

    • merge

      public void merge(int bucket, BytesRefBucketedSort other, int otherBucket)
      Merge the values from other's otherGroupId into groupId.
    • toBlock

      public Block toBlock(BlockFactory blockFactory, IntVector selected)
      Creates a block with the values from the selected groups.
    • close

      public final void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.elasticsearch.core.Releasable