Class AbstractBlockBuilder

java.lang.Object
org.elasticsearch.compute.data.AbstractBlockBuilder
All Implemented Interfaces:
Closeable, AutoCloseable, Block.Builder, org.elasticsearch.core.Releasable, BlockLoader.Builder
Direct Known Subclasses:
AggregateMetricDoubleBlockBuilder

public abstract class AbstractBlockBuilder extends Object implements Block.Builder
  • Field Details

    • blockFactory

      protected final BlockFactory blockFactory
    • firstValueIndexes

      protected int[] firstValueIndexes
    • nullsMask

      protected BitSet nullsMask
    • valueCount

      protected int valueCount
    • positionCount

      protected int positionCount
    • positionEntryIsOpen

      protected boolean positionEntryIsOpen
    • hasNonNullValue

      protected boolean hasNonNullValue
    • hasMultiValues

      protected boolean hasMultiValues
    • mvOrdering

      protected Block.MvOrdering mvOrdering
    • estimatedBytes

      protected long estimatedBytes
      The number of bytes currently estimated with the breaker.
  • Constructor Details

    • AbstractBlockBuilder

      protected AbstractBlockBuilder(BlockFactory blockFactory)
  • Method Details

    • appendNull

      public AbstractBlockBuilder appendNull()
      Description copied from interface: Block.Builder
      Appends a null value to the block.
      Specified by:
      appendNull in interface Block.Builder
      Specified by:
      appendNull in interface BlockLoader.Builder
    • writeNullValue

      protected void writeNullValue()
    • valuesLength

      protected abstract int valuesLength()
      The length of the internal values array.
    • beginPositionEntry

      public AbstractBlockBuilder beginPositionEntry()
      Description copied from interface: Block.Builder
      Begins a multivalued entry. Calling this for the first time will put the builder into a mode that generates Blocks that return true from Block.mayHaveMultivaluedFields() which can force less optimized code paths. So don't call this unless you are sure you are emitting more than one value for this position.
      Specified by:
      beginPositionEntry in interface Block.Builder
      Specified by:
      beginPositionEntry in interface BlockLoader.Builder
    • endPositionEntry

      public AbstractBlockBuilder endPositionEntry()
      Description copied from interface: Block.Builder
      Ends the current multi-value entry.
      Specified by:
      endPositionEntry in interface Block.Builder
      Specified by:
      endPositionEntry in interface BlockLoader.Builder
    • isDense

      protected final boolean isDense()
    • singleValued

      protected final boolean singleValued()
    • updatePosition

      protected final void updatePosition()
    • finish

      protected final void finish()
      Called during implementations of Block.Builder.build() as a first step to check if the block is still open and to finish the last position.
    • estimatedBytes

      public long estimatedBytes()
      Description copied from interface: Block.Builder
      An estimate of the number of bytes the Block created by Block.Builder.build() will use. This may overestimate the size but shouldn't underestimate it.
      Specified by:
      estimatedBytes in interface Block.Builder
    • built

      protected final void built()
      Called during implementations of Block.Builder.build() as a last step to mark the Builder as closed and make sure that further closes don't double free memory.
    • growValuesArray

      protected abstract void growValuesArray(int newSize)
    • elementSize

      protected abstract int elementSize()
      The number of bytes used to represent each value element.
    • ensureCapacity

      protected final void ensureCapacity()
    • 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
    • extraClose

      protected void extraClose()
      Called when first closed.
    • adjustBreaker

      protected void adjustBreaker(long deltaBytes)
    • isReleased

      public boolean isReleased()