Class BlockFactory

java.lang.Object
org.elasticsearch.compute.data.BlockFactory

public class BlockFactory extends Object
  • Field Details

    • LOCAL_BREAKER_OVER_RESERVED_SIZE_SETTING

      public static final String LOCAL_BREAKER_OVER_RESERVED_SIZE_SETTING
      See Also:
    • LOCAL_BREAKER_OVER_RESERVED_DEFAULT_SIZE

      public static final ByteSizeValue LOCAL_BREAKER_OVER_RESERVED_DEFAULT_SIZE
    • LOCAL_BREAKER_OVER_RESERVED_MAX_SIZE_SETTING

      public static final String LOCAL_BREAKER_OVER_RESERVED_MAX_SIZE_SETTING
      See Also:
    • LOCAL_BREAKER_OVER_RESERVED_DEFAULT_MAX_SIZE

      public static final ByteSizeValue LOCAL_BREAKER_OVER_RESERVED_DEFAULT_MAX_SIZE
    • MAX_BLOCK_PRIMITIVE_ARRAY_SIZE_SETTING

      public static final String MAX_BLOCK_PRIMITIVE_ARRAY_SIZE_SETTING
      See Also:
    • DEFAULT_MAX_BLOCK_PRIMITIVE_ARRAY_SIZE

      public static final ByteSizeValue DEFAULT_MAX_BLOCK_PRIMITIVE_ARRAY_SIZE
  • Constructor Details

  • Method Details

    • getInstance

      public static BlockFactory getInstance(CircuitBreaker breaker, BigArrays bigArrays)
    • breaker

      public CircuitBreaker breaker()
    • bigArrays

      public BigArrays bigArrays()
    • parent

      protected BlockFactory parent()
    • newChildFactory

      public BlockFactory newChildFactory(LocalCircuitBreaker childBreaker)
    • adjustBreaker

      public void adjustBreaker(long delta) throws CircuitBreakingException
      Adjust the circuit breaker with the given delta, if the delta is negative, the breaker will be adjusted without tripping.
      Throws:
      CircuitBreakingException - if the breaker was put above its limit
    • preAdjustBreakerForBoolean

      public long preAdjustBreakerForBoolean(int positionCount)
      Pre-adjusts the breaker for the given position count and element type. Returns the pre-adjusted amount.
    • preAdjustBreakerForInt

      public long preAdjustBreakerForInt(int positionCount)
    • preAdjustBreakerForLong

      public long preAdjustBreakerForLong(int positionCount)
    • preAdjustBreakerForDouble

      public long preAdjustBreakerForDouble(int positionCount)
    • newBooleanBlockBuilder

      public BooleanBlock.Builder newBooleanBlockBuilder(int estimatedSize)
    • newBooleanVectorFixedBuilder

      public BooleanVector.FixedBuilder newBooleanVectorFixedBuilder(int size)
      Build a BooleanVector.FixedBuilder that never grows.
    • newBooleanArrayBlock

      public final BooleanBlock newBooleanArrayBlock(boolean[] values, int pc, int[] firstValueIndexes, BitSet nulls, Block.MvOrdering mvOrdering)
    • newBooleanArrayBlock

      public BooleanBlock newBooleanArrayBlock(boolean[] values, int pc, int[] fvi, BitSet nulls, Block.MvOrdering mvOrder, long preAdjustedBytes)
    • newBooleanVectorBuilder

      public BooleanVector.Builder newBooleanVectorBuilder(int estimatedSize)
    • newBooleanArrayVector

      public final BooleanVector newBooleanArrayVector(boolean[] values, int positionCount)
    • newBooleanArrayVector

      public BooleanVector newBooleanArrayVector(boolean[] values, int positionCount, long preAdjustedBytes)
    • newConstantBooleanBlockWith

      public final BooleanBlock newConstantBooleanBlockWith(boolean value, int positions)
    • newConstantBooleanBlockWith

      public BooleanBlock newConstantBooleanBlockWith(boolean value, int positions, long preAdjustedBytes)
    • newConstantBooleanVector

      public BooleanVector newConstantBooleanVector(boolean value, int positions)
    • newIntBlockBuilder

      public IntBlock.Builder newIntBlockBuilder(int estimatedSize)
    • newIntArrayBlock

      public final IntBlock newIntArrayBlock(int[] values, int positionCount, int[] firstValueIndexes, BitSet nulls, Block.MvOrdering mvOrdering)
    • newIntArrayBlock

      public IntBlock newIntArrayBlock(int[] values, int pc, int[] fvi, BitSet nulls, Block.MvOrdering mvOrdering, long preAdjustedBytes)
    • newIntVectorBuilder

      public IntVector.Builder newIntVectorBuilder(int estimatedSize)
    • newIntVectorFixedBuilder

      public IntVector.FixedBuilder newIntVectorFixedBuilder(int size)
      Build a IntVector.FixedBuilder that never grows.
    • newIntArrayVector

      public final IntVector newIntArrayVector(int[] values, int positionCount)
      Creates a new Vector with the given values and positionCount. Equivalent to: newIntArrayVector(values, positionCount, 0L); // with zero pre-adjusted bytes
    • newIntArrayVector

      public IntVector newIntArrayVector(int[] values, int positionCount, long preAdjustedBytes)
      Creates a new Vector with the given values and positionCount, where the caller has already pre-adjusted a number of bytes with the factory's breaker. long preAdjustedBytes = blockFactory.preAdjustBreakerForInt(positionCount); int[] values = new int[positionCount]; for (int i = 0; i < positionCount; i++) { values[i] = doWhateverStuff } var vector = blockFactory.newIntArrayVector(values, positionCount, preAdjustedBytes);
    • newConstantIntBlockWith

      public final IntBlock newConstantIntBlockWith(int value, int positions)
    • newConstantIntBlockWith

      public IntBlock newConstantIntBlockWith(int value, int positions, long preAdjustedBytes)
    • newConstantIntVector

      public IntVector newConstantIntVector(int value, int positions)
    • newFloatBlockBuilder

      public FloatBlock.Builder newFloatBlockBuilder(int estimatedSize)
    • newFloatArrayBlock

      public final FloatBlock newFloatArrayBlock(float[] values, int pc, int[] firstValueIndexes, BitSet nulls, Block.MvOrdering mvOrdering)
    • newFloatArrayBlock

      public FloatBlock newFloatArrayBlock(float[] values, int pc, int[] fvi, BitSet nulls, Block.MvOrdering mvOrdering, long preAdjustedBytes)
    • newFloatVectorBuilder

      public FloatVector.Builder newFloatVectorBuilder(int estimatedSize)
    • newFloatVectorFixedBuilder

      public FloatVector.FixedBuilder newFloatVectorFixedBuilder(int size)
      Build a FloatVector.FixedBuilder that never grows.
    • newFloatArrayVector

      public final FloatVector newFloatArrayVector(float[] values, int positionCount)
    • newFloatArrayVector

      public FloatVector newFloatArrayVector(float[] values, int positionCount, long preAdjustedBytes)
    • newConstantFloatBlockWith

      public final FloatBlock newConstantFloatBlockWith(float value, int positions)
    • newConstantFloatBlockWith

      public FloatBlock newConstantFloatBlockWith(float value, int positions, long preAdjustedBytes)
    • newConstantFloatVector

      public FloatVector newConstantFloatVector(float value, int positions)
    • newLongBlockBuilder

      public LongBlock.Builder newLongBlockBuilder(int estimatedSize)
    • newLongArrayBlock

      public final LongBlock newLongArrayBlock(long[] values, int pc, int[] firstValueIndexes, BitSet nulls, Block.MvOrdering mvOrdering)
    • newLongArrayBlock

      public LongBlock newLongArrayBlock(long[] values, int pc, int[] fvi, BitSet nulls, Block.MvOrdering mvOrdering, long preAdjustedBytes)
    • newLongVectorBuilder

      public LongVector.Builder newLongVectorBuilder(int estimatedSize)
    • newLongVectorFixedBuilder

      public LongVector.FixedBuilder newLongVectorFixedBuilder(int size)
      Build a LongVector.FixedBuilder that never grows.
    • newLongArrayVector

      public final LongVector newLongArrayVector(long[] values, int positionCount)
    • newLongArrayVector

      public LongVector newLongArrayVector(long[] values, int positionCount, long preAdjustedBytes)
    • newConstantLongBlockWith

      public final LongBlock newConstantLongBlockWith(long value, int positions)
    • newConstantLongBlockWith

      public LongBlock newConstantLongBlockWith(long value, int positions, long preAdjustedBytes)
    • newConstantLongVector

      public LongVector newConstantLongVector(long value, int positions)
    • newDoubleBlockBuilder

      public DoubleBlock.Builder newDoubleBlockBuilder(int estimatedSize)
    • newDoubleArrayBlock

      public final DoubleBlock newDoubleArrayBlock(double[] values, int pc, int[] firstValueIndexes, BitSet nulls, Block.MvOrdering mvOrdering)
    • newDoubleArrayBlock

      public DoubleBlock newDoubleArrayBlock(double[] values, int pc, int[] fvi, BitSet nulls, Block.MvOrdering mvOrdering, long preAdjustedBytes)
    • newDoubleVectorBuilder

      public DoubleVector.Builder newDoubleVectorBuilder(int estimatedSize)
    • newDoubleVectorFixedBuilder

      public DoubleVector.FixedBuilder newDoubleVectorFixedBuilder(int size)
      Build a DoubleVector.FixedBuilder that never grows.
    • newDoubleArrayVector

      public final DoubleVector newDoubleArrayVector(double[] values, int positionCount)
    • newDoubleArrayVector

      public DoubleVector newDoubleArrayVector(double[] values, int positionCount, long preAdjustedBytes)
    • newConstantDoubleBlockWith

      public final DoubleBlock newConstantDoubleBlockWith(double value, int positions)
    • newConstantDoubleBlockWith

      public DoubleBlock newConstantDoubleBlockWith(double value, int positions, long preAdjustedBytes)
    • newConstantDoubleVector

      public DoubleVector newConstantDoubleVector(double value, int positions)
    • newBytesRefBlockBuilder

      public BytesRefBlock.Builder newBytesRefBlockBuilder(int estimatedSize)
    • newBytesRefArrayBlock

      public BytesRefBlock newBytesRefArrayBlock(BytesRefArray values, int pc, int[] firstValueIndexes, BitSet nulls, Block.MvOrdering mvOrdering)
    • newBytesRefVectorBuilder

      public BytesRefVector.Builder newBytesRefVectorBuilder(int estimatedSize)
    • newBytesRefArrayVector

      public BytesRefVector newBytesRefArrayVector(BytesRefArray values, int positionCount)
    • newConstantBytesRefBlockWith

      public BytesRefBlock newConstantBytesRefBlockWith(org.apache.lucene.util.BytesRef value, int positions)
    • newConstantBytesRefVector

      public BytesRefVector newConstantBytesRefVector(org.apache.lucene.util.BytesRef value, int positions)
    • newConstantNullBlock

      public Block newConstantNullBlock(int positions)
    • newAggregateMetricDoubleBlockBuilder

      public AggregateMetricDoubleBlockBuilder newAggregateMetricDoubleBlockBuilder(int estimatedSize)
    • newConstantAggregateMetricDoubleBlock

      public final Block newConstantAggregateMetricDoubleBlock(AggregateMetricDoubleBlockBuilder.AggregateMetricDoubleLiteral value, int positions)
    • maxPrimitiveArrayBytes

      public long maxPrimitiveArrayBytes()
      Returns the maximum number of bytes that a Block should be backed by a primitive array before switching to using BigArrays.