From b938dd6816ad64682cde9294fe49fb2c87c0cc07 Mon Sep 17 00:00:00 2001 From: ChrisHegarty Date: Tue, 19 Sep 2023 17:33:00 +0100 Subject: [PATCH] use a non-breaking block factory by default --- .../compute/data/BooleanArrayBlock.java | 2 +- .../compute/data/BooleanArrayVector.java | 2 +- .../compute/data/BooleanBigArrayVector.java | 2 +- .../elasticsearch/compute/data/BooleanBlock.java | 10 ++++++---- .../elasticsearch/compute/data/BooleanVector.java | 5 +++-- .../compute/data/BytesRefArrayBlock.java | 2 +- .../compute/data/BytesRefArrayVector.java | 2 +- .../elasticsearch/compute/data/BytesRefBlock.java | 10 ++++++---- .../compute/data/BytesRefVector.java | 5 +++-- .../compute/data/ConstantBooleanVector.java | 2 +- .../compute/data/ConstantBytesRefVector.java | 2 +- .../compute/data/ConstantDoubleVector.java | 2 +- .../compute/data/ConstantIntVector.java | 2 +- .../compute/data/ConstantLongVector.java | 2 +- .../compute/data/DoubleArrayBlock.java | 2 +- .../compute/data/DoubleArrayVector.java | 2 +- .../compute/data/DoubleBigArrayVector.java | 2 +- .../elasticsearch/compute/data/DoubleBlock.java | 10 ++++++---- .../elasticsearch/compute/data/DoubleVector.java | 5 +++-- .../elasticsearch/compute/data/IntArrayBlock.java | 2 +- .../compute/data/IntArrayVector.java | 2 +- .../compute/data/IntBigArrayVector.java | 2 +- .../org/elasticsearch/compute/data/IntBlock.java | 10 ++++++---- .../org/elasticsearch/compute/data/IntVector.java | 5 +++-- .../compute/data/LongArrayBlock.java | 2 +- .../compute/data/LongArrayVector.java | 2 +- .../compute/data/LongBigArrayVector.java | 2 +- .../org/elasticsearch/compute/data/LongBlock.java | 10 ++++++---- .../elasticsearch/compute/data/LongVector.java | 5 +++-- .../aggregation/blockhash/LongBlockHash.java | 2 +- .../org/elasticsearch/compute/data/Block.java | 5 +++-- .../elasticsearch/compute/data/BlockFactory.java | 15 ++++++++++++++- .../compute/data/ConstantNullBlock.java | 3 ++- .../compute/data/X-ArrayBlock.java.st | 2 +- .../compute/data/X-ArrayVector.java.st | 2 +- .../compute/data/X-BigArrayVector.java.st | 2 +- .../elasticsearch/compute/data/X-Block.java.st | 10 ++++++---- .../compute/data/X-ConstantVector.java.st | 2 +- .../elasticsearch/compute/data/X-Vector.java.st | 5 +++-- .../compute/operator/ThrowingDriverContext.java | 2 +- .../operator/topn/ResultBuilderForDoc.java | 6 +++--- .../data/BlockBuilderAppendBlockTests.java | 2 +- .../compute/operator/AnyOperatorTestCase.java | 2 +- .../compute/operator/AsyncOperatorTests.java | 2 +- .../compute/operator/DriverContextTests.java | 2 +- .../compute/operator/OperatorTestCase.java | 2 +- .../compute/operator/RowOperatorTests.java | 2 +- .../SequenceDoubleBlockSourceOperator.java | 2 +- .../operator/SequenceLongBlockSourceOperator.java | 2 +- .../operator/exchange/ExchangeServiceTests.java | 2 +- 50 files changed, 110 insertions(+), 77 deletions(-) diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanArrayBlock.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanArrayBlock.java index 3f481f2c53e04..fafe1ce5a0416 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanArrayBlock.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanArrayBlock.java @@ -24,7 +24,7 @@ public final class BooleanArrayBlock extends AbstractArrayBlock implements Boole private final boolean[] values; public BooleanArrayBlock(boolean[] values, int positionCount, int[] firstValueIndexes, BitSet nulls, MvOrdering mvOrdering) { - this(values, positionCount, firstValueIndexes, nulls, mvOrdering, BlockFactory.getGlobalInstance()); + this(values, positionCount, firstValueIndexes, nulls, mvOrdering, BlockFactory.getNonBreakingInstance()); } public BooleanArrayBlock( diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanArrayVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanArrayVector.java index 8b59d18850165..062f36b820966 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanArrayVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanArrayVector.java @@ -22,7 +22,7 @@ public final class BooleanArrayVector extends AbstractVector implements BooleanV private final boolean[] values; public BooleanArrayVector(boolean[] values, int positionCount) { - this(values, positionCount, BlockFactory.getGlobalInstance()); + this(values, positionCount, BlockFactory.getNonBreakingInstance()); } public BooleanArrayVector(boolean[] values, int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanBigArrayVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanBigArrayVector.java index aba7c38e7db45..777914f51aef4 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanBigArrayVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanBigArrayVector.java @@ -22,7 +22,7 @@ public final class BooleanBigArrayVector extends AbstractVector implements Boole private final BitArray values; public BooleanBigArrayVector(BitArray values, int positionCount) { - this(values, positionCount, BlockFactory.getGlobalInstance()); + this(values, positionCount, BlockFactory.getNonBreakingInstance()); } public BooleanBigArrayVector(BitArray values, int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanBlock.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanBlock.java index b12a4a5f6f667..f5c611e08d3b7 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanBlock.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanBlock.java @@ -157,18 +157,20 @@ static int hash(BooleanBlock block) { return result; } - /** Returns a builder using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static Builder newBlockBuilder(int estimatedSize) { - return newBlockBuilder(estimatedSize, BlockFactory.getGlobalInstance()); + return newBlockBuilder(estimatedSize, BlockFactory.getNonBreakingInstance()); } static Builder newBlockBuilder(int estimatedSize, BlockFactory blockFactory) { return blockFactory.newBooleanBlockBuilder(estimatedSize); } - /** Returns a block using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a block using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static BooleanBlock newConstantBlockWith(boolean value, int positions) { - return newConstantBlockWith(value, positions, BlockFactory.getGlobalInstance()); + return newConstantBlockWith(value, positions, BlockFactory.getNonBreakingInstance()); } static BooleanBlock newConstantBlockWith(boolean value, int positions, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanVector.java index 0790e4b47919a..03eacea5fe1e5 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BooleanVector.java @@ -100,9 +100,10 @@ default void writeTo(StreamOutput out) throws IOException { } } - /** Returns a builder using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static Builder newVectorBuilder(int estimatedSize) { - return newVectorBuilder(estimatedSize, BlockFactory.getGlobalInstance()); + return newVectorBuilder(estimatedSize, BlockFactory.getNonBreakingInstance()); } static Builder newVectorBuilder(int estimatedSize, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BytesRefArrayBlock.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BytesRefArrayBlock.java index 06a77143c3337..bbde59fe6236f 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BytesRefArrayBlock.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BytesRefArrayBlock.java @@ -25,7 +25,7 @@ public final class BytesRefArrayBlock extends AbstractArrayBlock implements Byte private final BytesRefArray values; public BytesRefArrayBlock(BytesRefArray values, int positionCount, int[] firstValueIndexes, BitSet nulls, MvOrdering mvOrdering) { - this(values, positionCount, firstValueIndexes, nulls, mvOrdering, BlockFactory.getGlobalInstance()); + this(values, positionCount, firstValueIndexes, nulls, mvOrdering, BlockFactory.getNonBreakingInstance()); } public BytesRefArrayBlock( diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BytesRefArrayVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BytesRefArrayVector.java index 1c24eb60663a4..92027a6f52ee1 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BytesRefArrayVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BytesRefArrayVector.java @@ -23,7 +23,7 @@ public final class BytesRefArrayVector extends AbstractVector implements BytesRe private final BytesRefArray values; public BytesRefArrayVector(BytesRefArray values, int positionCount) { - this(values, positionCount, BlockFactory.getGlobalInstance()); + this(values, positionCount, BlockFactory.getNonBreakingInstance()); } public BytesRefArrayVector(BytesRefArray values, int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BytesRefBlock.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BytesRefBlock.java index 9144843971632..c1e1d17854232 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BytesRefBlock.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BytesRefBlock.java @@ -160,18 +160,20 @@ static int hash(BytesRefBlock block) { return result; } - /** Returns a builder using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static Builder newBlockBuilder(int estimatedSize) { - return newBlockBuilder(estimatedSize, BlockFactory.getGlobalInstance()); + return newBlockBuilder(estimatedSize, BlockFactory.getNonBreakingInstance()); } static Builder newBlockBuilder(int estimatedSize, BlockFactory blockFactory) { return blockFactory.newBytesRefBlockBuilder(estimatedSize); } - /** Returns a block using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a block using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static BytesRefBlock newConstantBlockWith(BytesRef value, int positions) { - return newConstantBlockWith(value, positions, BlockFactory.getGlobalInstance()); + return newConstantBlockWith(value, positions, BlockFactory.getNonBreakingInstance()); } static BytesRefBlock newConstantBlockWith(BytesRef value, int positions, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BytesRefVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BytesRefVector.java index 622e595bc815b..bbcf83133c86d 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BytesRefVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/BytesRefVector.java @@ -100,9 +100,10 @@ default void writeTo(StreamOutput out) throws IOException { } } - /** Returns a builder using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static Builder newVectorBuilder(int estimatedSize) { - return newVectorBuilder(estimatedSize, BlockFactory.getGlobalInstance()); + return newVectorBuilder(estimatedSize, BlockFactory.getNonBreakingInstance()); } static Builder newVectorBuilder(int estimatedSize, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantBooleanVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantBooleanVector.java index e2f7fc2e62e8b..7119721811401 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantBooleanVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantBooleanVector.java @@ -20,7 +20,7 @@ public final class ConstantBooleanVector extends AbstractVector implements Boole private final boolean value; public ConstantBooleanVector(boolean value, int positionCount) { - this(value, positionCount, BlockFactory.getGlobalInstance()); + this(value, positionCount, BlockFactory.getNonBreakingInstance()); } public ConstantBooleanVector(boolean value, int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantBytesRefVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantBytesRefVector.java index e2ad9be6f97d8..caa30a5a2148c 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantBytesRefVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantBytesRefVector.java @@ -21,7 +21,7 @@ public final class ConstantBytesRefVector extends AbstractVector implements Byte private final BytesRef value; public ConstantBytesRefVector(BytesRef value, int positionCount) { - this(value, positionCount, BlockFactory.getGlobalInstance()); + this(value, positionCount, BlockFactory.getNonBreakingInstance()); } public ConstantBytesRefVector(BytesRef value, int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantDoubleVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantDoubleVector.java index 6822e402625be..be41df1188ea0 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantDoubleVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantDoubleVector.java @@ -20,7 +20,7 @@ public final class ConstantDoubleVector extends AbstractVector implements Double private final double value; public ConstantDoubleVector(double value, int positionCount) { - this(value, positionCount, BlockFactory.getGlobalInstance()); + this(value, positionCount, BlockFactory.getNonBreakingInstance()); } public ConstantDoubleVector(double value, int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantIntVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantIntVector.java index 7145a95e9a833..4854db91fe567 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantIntVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantIntVector.java @@ -20,7 +20,7 @@ public final class ConstantIntVector extends AbstractVector implements IntVector private final int value; public ConstantIntVector(int value, int positionCount) { - this(value, positionCount, BlockFactory.getGlobalInstance()); + this(value, positionCount, BlockFactory.getNonBreakingInstance()); } public ConstantIntVector(int value, int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantLongVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantLongVector.java index bf68580380199..1f33d97e9c39d 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantLongVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/ConstantLongVector.java @@ -20,7 +20,7 @@ public final class ConstantLongVector extends AbstractVector implements LongVect private final long value; public ConstantLongVector(long value, int positionCount) { - this(value, positionCount, BlockFactory.getGlobalInstance()); + this(value, positionCount, BlockFactory.getNonBreakingInstance()); } public ConstantLongVector(long value, int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleArrayBlock.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleArrayBlock.java index 1fcb7db014c83..c8d7035b31d3b 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleArrayBlock.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleArrayBlock.java @@ -24,7 +24,7 @@ public final class DoubleArrayBlock extends AbstractArrayBlock implements Double private final double[] values; public DoubleArrayBlock(double[] values, int positionCount, int[] firstValueIndexes, BitSet nulls, MvOrdering mvOrdering) { - this(values, positionCount, firstValueIndexes, nulls, mvOrdering, BlockFactory.getGlobalInstance()); + this(values, positionCount, firstValueIndexes, nulls, mvOrdering, BlockFactory.getNonBreakingInstance()); } public DoubleArrayBlock( diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleArrayVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleArrayVector.java index c6827157b0622..8cf69a1fbed76 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleArrayVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleArrayVector.java @@ -22,7 +22,7 @@ public final class DoubleArrayVector extends AbstractVector implements DoubleVec private final double[] values; public DoubleArrayVector(double[] values, int positionCount) { - this(values, positionCount, BlockFactory.getGlobalInstance()); + this(values, positionCount, BlockFactory.getNonBreakingInstance()); } public DoubleArrayVector(double[] values, int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleBigArrayVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleBigArrayVector.java index b1a35b7c0c267..f97384bc0a4b8 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleBigArrayVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleBigArrayVector.java @@ -22,7 +22,7 @@ public final class DoubleBigArrayVector extends AbstractVector implements Double private final DoubleArray values; public DoubleBigArrayVector(DoubleArray values, int positionCount) { - this(values, positionCount, BlockFactory.getGlobalInstance()); + this(values, positionCount, BlockFactory.getNonBreakingInstance()); } public DoubleBigArrayVector(DoubleArray values, int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleBlock.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleBlock.java index 96ad8c44b41a9..648d1316444c6 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleBlock.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleBlock.java @@ -158,18 +158,20 @@ static int hash(DoubleBlock block) { return result; } - /** Returns a builder using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static Builder newBlockBuilder(int estimatedSize) { - return newBlockBuilder(estimatedSize, BlockFactory.getGlobalInstance()); + return newBlockBuilder(estimatedSize, BlockFactory.getNonBreakingInstance()); } static Builder newBlockBuilder(int estimatedSize, BlockFactory blockFactory) { return blockFactory.newDoubleBlockBuilder(estimatedSize); } - /** Returns a block using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a block using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static DoubleBlock newConstantBlockWith(double value, int positions) { - return newConstantBlockWith(value, positions, BlockFactory.getGlobalInstance()); + return newConstantBlockWith(value, positions, BlockFactory.getNonBreakingInstance()); } static DoubleBlock newConstantBlockWith(double value, int positions, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleVector.java index e055483958aa0..975cb67321202 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/DoubleVector.java @@ -101,9 +101,10 @@ default void writeTo(StreamOutput out) throws IOException { } } - /** Returns a builder using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static Builder newVectorBuilder(int estimatedSize) { - return newVectorBuilder(estimatedSize, BlockFactory.getGlobalInstance()); + return newVectorBuilder(estimatedSize, BlockFactory.getNonBreakingInstance()); } static Builder newVectorBuilder(int estimatedSize, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntArrayBlock.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntArrayBlock.java index 98b41bcc32370..782e45a6df463 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntArrayBlock.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntArrayBlock.java @@ -24,7 +24,7 @@ public final class IntArrayBlock extends AbstractArrayBlock implements IntBlock private final int[] values; public IntArrayBlock(int[] values, int positionCount, int[] firstValueIndexes, BitSet nulls, MvOrdering mvOrdering) { - this(values, positionCount, firstValueIndexes, nulls, mvOrdering, BlockFactory.getGlobalInstance()); + this(values, positionCount, firstValueIndexes, nulls, mvOrdering, BlockFactory.getNonBreakingInstance()); } public IntArrayBlock( diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntArrayVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntArrayVector.java index 72c39124f498b..b6a2564b3437b 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntArrayVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntArrayVector.java @@ -22,7 +22,7 @@ public final class IntArrayVector extends AbstractVector implements IntVector { private final int[] values; public IntArrayVector(int[] values, int positionCount) { - this(values, positionCount, BlockFactory.getGlobalInstance()); + this(values, positionCount, BlockFactory.getNonBreakingInstance()); } public IntArrayVector(int[] values, int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntBigArrayVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntBigArrayVector.java index e054722b4769e..f3bcc1ef9bb01 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntBigArrayVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntBigArrayVector.java @@ -22,7 +22,7 @@ public final class IntBigArrayVector extends AbstractVector implements IntVector private final IntArray values; public IntBigArrayVector(IntArray values, int positionCount) { - this(values, positionCount, BlockFactory.getGlobalInstance()); + this(values, positionCount, BlockFactory.getNonBreakingInstance()); } public IntBigArrayVector(IntArray values, int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntBlock.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntBlock.java index f656fe80031fe..fc728bfbdadea 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntBlock.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntBlock.java @@ -157,18 +157,20 @@ static int hash(IntBlock block) { return result; } - /** Returns a builder using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static Builder newBlockBuilder(int estimatedSize) { - return newBlockBuilder(estimatedSize, BlockFactory.getGlobalInstance()); + return newBlockBuilder(estimatedSize, BlockFactory.getNonBreakingInstance()); } static Builder newBlockBuilder(int estimatedSize, BlockFactory blockFactory) { return blockFactory.newIntBlockBuilder(estimatedSize); } - /** Returns a block using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a block using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static IntBlock newConstantBlockWith(int value, int positions) { - return newConstantBlockWith(value, positions, BlockFactory.getGlobalInstance()); + return newConstantBlockWith(value, positions, BlockFactory.getNonBreakingInstance()); } static IntBlock newConstantBlockWith(int value, int positions, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntVector.java index 3208deff85ab6..5a2e96c955cc4 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/IntVector.java @@ -100,9 +100,10 @@ default void writeTo(StreamOutput out) throws IOException { } } - /** Returns a builder using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static Builder newVectorBuilder(int estimatedSize) { - return newVectorBuilder(estimatedSize, BlockFactory.getGlobalInstance()); + return newVectorBuilder(estimatedSize, BlockFactory.getNonBreakingInstance()); } static Builder newVectorBuilder(int estimatedSize, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongArrayBlock.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongArrayBlock.java index c3696784f1cde..5d6c3d2931a85 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongArrayBlock.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongArrayBlock.java @@ -24,7 +24,7 @@ public final class LongArrayBlock extends AbstractArrayBlock implements LongBloc private final long[] values; public LongArrayBlock(long[] values, int positionCount, int[] firstValueIndexes, BitSet nulls, MvOrdering mvOrdering) { - this(values, positionCount, firstValueIndexes, nulls, mvOrdering, BlockFactory.getGlobalInstance()); + this(values, positionCount, firstValueIndexes, nulls, mvOrdering, BlockFactory.getNonBreakingInstance()); } public LongArrayBlock( diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongArrayVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongArrayVector.java index 2598295cac145..0b9d5e774c864 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongArrayVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongArrayVector.java @@ -22,7 +22,7 @@ public final class LongArrayVector extends AbstractVector implements LongVector private final long[] values; public LongArrayVector(long[] values, int positionCount) { - this(values, positionCount, BlockFactory.getGlobalInstance()); + this(values, positionCount, BlockFactory.getNonBreakingInstance()); } public LongArrayVector(long[] values, int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongBigArrayVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongBigArrayVector.java index 843d25b438cc9..3d3ac9ea09e32 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongBigArrayVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongBigArrayVector.java @@ -22,7 +22,7 @@ public final class LongBigArrayVector extends AbstractVector implements LongVect private final LongArray values; public LongBigArrayVector(LongArray values, int positionCount) { - this(values, positionCount, BlockFactory.getGlobalInstance()); + this(values, positionCount, BlockFactory.getNonBreakingInstance()); } public LongBigArrayVector(LongArray values, int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongBlock.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongBlock.java index 7dc1e5bdc0cfd..ff8370853a298 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongBlock.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongBlock.java @@ -158,18 +158,20 @@ static int hash(LongBlock block) { return result; } - /** Returns a builder using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static Builder newBlockBuilder(int estimatedSize) { - return newBlockBuilder(estimatedSize, BlockFactory.getGlobalInstance()); + return newBlockBuilder(estimatedSize, BlockFactory.getNonBreakingInstance()); } static Builder newBlockBuilder(int estimatedSize, BlockFactory blockFactory) { return blockFactory.newLongBlockBuilder(estimatedSize); } - /** Returns a block using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a block using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static LongBlock newConstantBlockWith(long value, int positions) { - return newConstantBlockWith(value, positions, BlockFactory.getGlobalInstance()); + return newConstantBlockWith(value, positions, BlockFactory.getNonBreakingInstance()); } static LongBlock newConstantBlockWith(long value, int positions, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongVector.java b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongVector.java index 0dd243ad53142..c01ea0236a734 100644 --- a/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongVector.java +++ b/x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/data/LongVector.java @@ -101,9 +101,10 @@ default void writeTo(StreamOutput out) throws IOException { } } - /** Returns a builder using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static Builder newVectorBuilder(int estimatedSize) { - return newVectorBuilder(estimatedSize, BlockFactory.getGlobalInstance()); + return newVectorBuilder(estimatedSize, BlockFactory.getNonBreakingInstance()); } static Builder newVectorBuilder(int estimatedSize, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/blockhash/LongBlockHash.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/blockhash/LongBlockHash.java index f5907815d83a7..919ca3dee6e36 100644 --- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/blockhash/LongBlockHash.java +++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/blockhash/LongBlockHash.java @@ -64,7 +64,7 @@ private IntVector add(LongVector vector) { for (int i = 0; i < vector.getPositionCount(); i++) { groups[i] = Math.toIntExact(hashOrdToGroupNullReserved(longHash.add(vector.getLong(i)))); } - return BlockFactory.getGlobalInstance().newIntArrayVector(groups, groups.length); + return vector.blockFactory().newIntArrayVector(groups, groups.length); } private IntBlock add(LongBlock block) { diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/Block.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/Block.java index 8c71261a175ac..0863940b35f59 100644 --- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/Block.java +++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/Block.java @@ -119,10 +119,11 @@ enum MvOrdering { Block expand(); /** - * {@return a constant null block with the given number of positions, using the global block factory}. + * {@return a constant null block with the given number of positions, using the non-breaking block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static Block constantNullBlock(int positions) { - return new ConstantNullBlock(positions, BlockFactory.getGlobalInstance()); + return new ConstantNullBlock(positions, BlockFactory.getNonBreakingInstance()); } static Block constantNullBlock(int positions, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/BlockFactory.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/BlockFactory.java index 1ede4ba0ae34d..c3a7f004641a8 100644 --- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/BlockFactory.java +++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/BlockFactory.java @@ -10,6 +10,7 @@ import org.apache.lucene.util.BytesRef; import org.elasticsearch.common.breaker.CircuitBreaker; import org.elasticsearch.common.breaker.CircuitBreakingException; +import org.elasticsearch.common.breaker.NoopCircuitBreaker; import org.elasticsearch.common.util.BigArrays; import org.elasticsearch.common.util.BytesRefArray; import org.elasticsearch.compute.data.Block.MvOrdering; @@ -20,6 +21,11 @@ public class BlockFactory { + private static final BlockFactory NON_BREAKING = BlockFactory.getInstance( + new NoopCircuitBreaker("noop-esql-breaker"), + BigArrays.NON_RECYCLING_INSTANCE + ); + private static final BlockFactory GLOBAL = loadGlobalFactory(); // new BlockFactory(new NoopCircuitBreaker("esql_noop_breaker"), BigArrays.NON_RECYCLING_INSTANCE); @@ -54,6 +60,13 @@ public static BlockFactory getGlobalInstance() { return GLOBAL; } + /** + * Returns the Non-Breaking block factory. + */ + public static BlockFactory getNonBreakingInstance() { + return NON_BREAKING; + } + public static BlockFactory getInstance(CircuitBreaker breaker, BigArrays bigArrays) { return new BlockFactory(breaker, bigArrays); } @@ -77,7 +90,7 @@ void adjustBreaker(final long delta, final boolean isDataAlreadyCreated) { // have to if the delta is negative if (delta > 0) { try { - breaker.addEstimateBytesAndMaybeBreak(delta, ""); + breaker.addEstimateBytesAndMaybeBreak(delta, ""); } catch (CircuitBreakingException e) { if (isDataAlreadyCreated) { // since we've already created the data, we need to diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/ConstantNullBlock.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/ConstantNullBlock.java index f0c1fec469704..48a327f303e8f 100644 --- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/ConstantNullBlock.java +++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/ConstantNullBlock.java @@ -19,8 +19,9 @@ */ public final class ConstantNullBlock extends AbstractBlock { + // Eventually, this should use the GLOBAL breaking instance ConstantNullBlock(int positionCount) { - this(positionCount, BlockFactory.getGlobalInstance()); + this(positionCount, BlockFactory.getNonBreakingInstance()); } ConstantNullBlock(int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-ArrayBlock.java.st b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-ArrayBlock.java.st index c834ff1821144..b6487c2409a84 100644 --- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-ArrayBlock.java.st +++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-ArrayBlock.java.st @@ -36,7 +36,7 @@ $else$ $endif$ public $Type$ArrayBlock($if(BytesRef)$BytesRefArray$else$$type$[]$endif$ values, int positionCount, int[] firstValueIndexes, BitSet nulls, MvOrdering mvOrdering) { - this(values, positionCount, firstValueIndexes, nulls, mvOrdering, BlockFactory.getGlobalInstance()); + this(values, positionCount, firstValueIndexes, nulls, mvOrdering, BlockFactory.getNonBreakingInstance()); } public $Type$ArrayBlock( diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-ArrayVector.java.st b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-ArrayVector.java.st index 1d89114f36669..7b5d049ec1f08 100644 --- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-ArrayVector.java.st +++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-ArrayVector.java.st @@ -35,7 +35,7 @@ $else$ $endif$ public $Type$ArrayVector($if(BytesRef)$BytesRefArray$else$$type$[]$endif$ values, int positionCount) { - this(values, positionCount, BlockFactory.getGlobalInstance()); + this(values, positionCount, BlockFactory.getNonBreakingInstance()); } public $Type$ArrayVector($if(BytesRef)$BytesRefArray$else$$type$[]$endif$ values, int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-BigArrayVector.java.st b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-BigArrayVector.java.st index 52496e8f5e6f4..82a2aae80c9de 100644 --- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-BigArrayVector.java.st +++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-BigArrayVector.java.st @@ -22,7 +22,7 @@ public final class $Type$BigArrayVector extends AbstractVector implements $Type$ private final $if(boolean)$Bit$else$$Type$$endif$Array values; public $Type$BigArrayVector($if(boolean)$Bit$else$$Type$$endif$Array values, int positionCount) { - this(values, positionCount, BlockFactory.getGlobalInstance()); + this(values, positionCount, BlockFactory.getNonBreakingInstance()); } public $Type$BigArrayVector($if(boolean)$Bit$else$$Type$$endif$Array values, int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-Block.java.st b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-Block.java.st index 3a88476a639a2..640ed8f05741c 100644 --- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-Block.java.st +++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-Block.java.st @@ -190,18 +190,20 @@ $endif$ return result; } - /** Returns a builder using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static Builder newBlockBuilder(int estimatedSize) { - return newBlockBuilder(estimatedSize, BlockFactory.getGlobalInstance()); + return newBlockBuilder(estimatedSize, BlockFactory.getNonBreakingInstance()); } static Builder newBlockBuilder(int estimatedSize, BlockFactory blockFactory) { return blockFactory.new$Type$BlockBuilder(estimatedSize); } - /** Returns a block using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a block using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static $Type$Block newConstantBlockWith($type$ value, int positions) { - return newConstantBlockWith(value, positions, BlockFactory.getGlobalInstance()); + return newConstantBlockWith(value, positions, BlockFactory.getNonBreakingInstance()); } static $Type$Block newConstantBlockWith($type$ value, int positions, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-ConstantVector.java.st b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-ConstantVector.java.st index b8bc1eadddca8..d1b724b37cd83 100644 --- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-ConstantVector.java.st +++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-ConstantVector.java.st @@ -23,7 +23,7 @@ public final class Constant$Type$Vector extends AbstractVector implements $Type$ private final $type$ value; public Constant$Type$Vector($type$ value, int positionCount) { - this(value, positionCount, BlockFactory.getGlobalInstance()); + this(value, positionCount, BlockFactory.getNonBreakingInstance()); } public Constant$Type$Vector($type$ value, int positionCount, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-Vector.java.st b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-Vector.java.st index 9e5193dc8a437..c86ab281e52af 100644 --- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-Vector.java.st +++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/data/X-Vector.java.st @@ -142,9 +142,10 @@ $endif$ } } - /** Returns a builder using the {@link BlockFactory#getGlobalInstance block factory}. */ + /** Returns a builder using the {@link BlockFactory#getNonBreakingInstance block factory}. */ + // Eventually, this should use the GLOBAL breaking instance static Builder newVectorBuilder(int estimatedSize) { - return newVectorBuilder(estimatedSize, BlockFactory.getGlobalInstance()); + return newVectorBuilder(estimatedSize, BlockFactory.getNonBreakingInstance()); } static Builder newVectorBuilder(int estimatedSize, BlockFactory blockFactory) { diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/ThrowingDriverContext.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/ThrowingDriverContext.java index 95b7d1c963f9a..313ec0b682602 100644 --- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/ThrowingDriverContext.java +++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/ThrowingDriverContext.java @@ -18,7 +18,7 @@ public class ThrowingDriverContext extends DriverContext { public ThrowingDriverContext() { - super(new ThrowingBigArrays(), BlockFactory.getGlobalInstance()); + super(new ThrowingBigArrays(), BlockFactory.getNonBreakingInstance()); } @Override diff --git a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/topn/ResultBuilderForDoc.java b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/topn/ResultBuilderForDoc.java index 2a47ab6ce2ab6..166d5be83b474 100644 --- a/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/topn/ResultBuilderForDoc.java +++ b/x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/operator/topn/ResultBuilderForDoc.java @@ -40,9 +40,9 @@ public void decodeValue(BytesRef values) { @Override public Block build() { return new DocVector( - BlockFactory.getGlobalInstance().newIntArrayVector(shards, position), - BlockFactory.getGlobalInstance().newIntArrayVector(segments, position), - BlockFactory.getGlobalInstance().newIntArrayVector(docs, position), + BlockFactory.getNonBreakingInstance().newIntArrayVector(shards, position), + BlockFactory.getNonBreakingInstance().newIntArrayVector(segments, position), + BlockFactory.getNonBreakingInstance().newIntArrayVector(docs, position), null ).asBlock(); } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/data/BlockBuilderAppendBlockTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/data/BlockBuilderAppendBlockTests.java index 0b6360b5efef3..a9f08eee02d70 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/data/BlockBuilderAppendBlockTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/data/BlockBuilderAppendBlockTests.java @@ -17,7 +17,7 @@ public class BlockBuilderAppendBlockTests extends ESTestCase { public void testBasic() { - IntBlock src = new IntBlockBuilder(10, BlockFactory.getGlobalInstance()).appendInt(1) + IntBlock src = new IntBlockBuilder(10, BlockFactory.getNonBreakingInstance()).appendInt(1) .appendNull() .beginPositionEntry() .appendInt(4) diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/AnyOperatorTestCase.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/AnyOperatorTestCase.java index 7d2097bd97b60..edbc59f9497fc 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/AnyOperatorTestCase.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/AnyOperatorTestCase.java @@ -96,6 +96,6 @@ protected final BigArrays nonBreakingBigArrays() { * A {@link DriverContext} with a nonBreakingBigArrays. */ protected final DriverContext driverContext() { - return new DriverContext(nonBreakingBigArrays(), BlockFactory.getGlobalInstance()); + return new DriverContext(nonBreakingBigArrays(), BlockFactory.getNonBreakingInstance()); } } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/AsyncOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/AsyncOperatorTests.java index 7bb965a6dec44..50d41978aa84f 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/AsyncOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/AsyncOperatorTests.java @@ -216,7 +216,7 @@ protected void doRun() { DriverContext driverContext() { return new DriverContext( new MockBigArrays(PageCacheRecycler.NON_RECYCLING_INSTANCE, new NoneCircuitBreakerService()).withCircuitBreaking(), - BlockFactory.getGlobalInstance() + BlockFactory.getNonBreakingInstance() ); } } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/DriverContextTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/DriverContextTests.java index aad665ed436ea..99d7a0eb01748 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/DriverContextTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/DriverContextTests.java @@ -147,7 +147,7 @@ static class AssertingDriverContext extends DriverContext { AssertingDriverContext() { super( new MockBigArrays(PageCacheRecycler.NON_RECYCLING_INSTANCE, new NoneCircuitBreakerService()), - BlockFactory.getGlobalInstance() + BlockFactory.getNonBreakingInstance() ); } diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/OperatorTestCase.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/OperatorTestCase.java index 2496cf9b9d5a4..6a2ace060e1e6 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/OperatorTestCase.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/OperatorTestCase.java @@ -177,7 +177,7 @@ public static void runDriver(List drivers) { drivers.add( new Driver( "dummy-session", - new DriverContext(BigArrays.NON_RECYCLING_INSTANCE, BlockFactory.getGlobalInstance()), + new DriverContext(BigArrays.NON_RECYCLING_INSTANCE, BlockFactory.getNonBreakingInstance()), () -> "dummy-driver", new SequenceLongBlockSourceOperator(LongStream.range(0, between(1, 100)), between(1, 100)), List.of(), diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/RowOperatorTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/RowOperatorTests.java index 344abd7c380a3..c8250eba5703a 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/RowOperatorTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/RowOperatorTests.java @@ -28,7 +28,7 @@ public class RowOperatorTests extends ESTestCase { final DriverContext driverContext = new DriverContext( new MockBigArrays(PageCacheRecycler.NON_RECYCLING_INSTANCE, new NoneCircuitBreakerService()).withCircuitBreaking(), - BlockFactory.getGlobalInstance() + BlockFactory.getNonBreakingInstance() ); public void testBoolean() { diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/SequenceDoubleBlockSourceOperator.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/SequenceDoubleBlockSourceOperator.java index 5b90a129a23b3..af14d0be0710c 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/SequenceDoubleBlockSourceOperator.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/SequenceDoubleBlockSourceOperator.java @@ -48,7 +48,7 @@ protected Page createPage(int positionOffset, int length) { array[i] = values[positionOffset + i]; } currentPosition += length; - return new Page(BlockFactory.getGlobalInstance().newDoubleArrayVector(array, array.length).asBlock()); // TODO: just for compile + return new Page(BlockFactory.getNonBreakingInstance().newDoubleArrayVector(array, array.length).asBlock()); } protected int remaining() { diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/SequenceLongBlockSourceOperator.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/SequenceLongBlockSourceOperator.java index 977616c61a3cc..0aa78f3ad0ab3 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/SequenceLongBlockSourceOperator.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/SequenceLongBlockSourceOperator.java @@ -48,7 +48,7 @@ protected Page createPage(int positionOffset, int length) { array[i] = values[positionOffset + i]; } currentPosition += length; - return new Page(BlockFactory.getGlobalInstance().newLongArrayVector(array, array.length).asBlock()); // TODO: just for compile + return new Page(BlockFactory.getNonBreakingInstance().newLongArrayVector(array, array.length).asBlock()); // TODO: just for compile } protected int remaining() { diff --git a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/exchange/ExchangeServiceTests.java b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/exchange/ExchangeServiceTests.java index 4fdb62d0359b9..5b6b33ea0b80a 100644 --- a/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/exchange/ExchangeServiceTests.java +++ b/x-pack/plugin/esql/compute/src/test/java/org/elasticsearch/compute/operator/exchange/ExchangeServiceTests.java @@ -480,7 +480,7 @@ public void sendResponse(Exception exception) throws IOException { DriverContext driverContext() { return new DriverContext( new MockBigArrays(PageCacheRecycler.NON_RECYCLING_INSTANCE, new NoneCircuitBreakerService()).withCircuitBreaking(), - BlockFactory.getGlobalInstance() + BlockFactory.getNonBreakingInstance() ); } }