Module org.elasticsearch.compute
Package org.elasticsearch.compute.data
Class AbstractDelegatingCompoundBlock<T extends Block>
java.lang.Object
org.elasticsearch.compute.data.AbstractNonThreadSafeRefCounted
org.elasticsearch.compute.data.AbstractDelegatingCompoundBlock<T>
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.lucene.util.Accountable,Writeable,Block,org.elasticsearch.core.RefCounted,org.elasticsearch.core.Releasable,BlockLoader.Block
- Direct Known Subclasses:
AggregateMetricDoubleArrayBlock,TDigestArrayBlock
public abstract class AbstractDelegatingCompoundBlock<T extends Block>
extends AbstractNonThreadSafeRefCounted
implements Block
Abstract base class for block types that are implemented by delegating to several concrete sub blocks.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.elasticsearch.compute.data.Block
Block.Builder, Block.MvOrderingNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLEFields inherited from interface org.elasticsearch.compute.data.Block
ESQL_AGGREGATE_METRIC_DOUBLE_BLOCK, MAX_LOOKUP, PAGE_MEM_OVERHEAD_PER_BLOCK, SERIALIZE_BLOCK_ARRAY, SERIALIZE_BLOCK_BIG_ARRAY, SERIALIZE_BLOCK_ORDINAL, SERIALIZE_BLOCK_VALUES, SERIALIZE_BLOCK_VECTORFields inherited from interface org.elasticsearch.core.RefCounted
ALWAYS_REFERENCED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidBefore passing a Block to another Driver, it is necessary to switch the owning block factory to its parent, which is associated with the global circuit breaker.The block factory associated with this block.protected abstract TbuildFromSubBlocks(List<Block> subBlocks) Construct a new instance of the block, based on the given list of sub-blocks.protected voidThis is called when the number of references reaches zero.deepCopy(BlockFactory blockFactory) Make a deep copy of thisBlockusing the providedBlockFactory, likely copying all data.filter(boolean mayContainDuplicates, int... positions) Creates a new block that only exposes the positions provided.intReturns the number of positions (rows) in this block.keepMask(BooleanVector mask) longslice(int beginInclusive, int endExclusive) Methods inherited from class org.elasticsearch.compute.data.AbstractNonThreadSafeRefCounted
close, decRef, hasReferences, incRef, isReleased, tryIncRefMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResourcesMethods inherited from interface org.elasticsearch.compute.data.Block
areAllValuesNull, asVector, doesHaveMultivaluedFields, elementType, expand, getFirstValueIndex, getTotalValueCount, getValueCount, insertNulls, isNull, isReleased, lookup, mayHaveMultivaluedFields, mayHaveNulls, mvDeduplicated, mvOrdering, mvSortedAscending, writeToMethods inherited from interface org.elasticsearch.core.RefCounted
decRef, hasReferences, incRef, mustIncRef, tryIncRefMethods inherited from interface org.elasticsearch.core.Releasable
close
-
Constructor Details
-
AbstractDelegatingCompoundBlock
public AbstractDelegatingCompoundBlock()
-
-
Method Details
-
getSubBlocks
- Returns:
- a list of the sub-blocks composing this compound block. The order of the list should match the order
expected by
buildFromSubBlocks(List)
-
buildFromSubBlocks
Construct a new instance of the block, based on the given list of sub-blocks.- Parameters:
subBlocks- List of sub-blocks, in the same order asgetSubBlocks()- Returns:
- a new instance based on the given blocks.
-
allowPassingToDifferentDriver
public void allowPassingToDifferentDriver()Description copied from interface:BlockBefore passing a Block to another Driver, it is necessary to switch the owning block factory to its parent, which is associated with the global circuit breaker. This ensures that when the new driver releases this Block, it returns memory directly to the parent block factory instead of the local block factory of this Block. This is important because the local block factory is not thread safe and doesn't support simultaneous access by more than one thread.- Specified by:
allowPassingToDifferentDriverin interfaceBlock
-
blockFactory
Description copied from interface:BlockThe block factory associated with this block.- Specified by:
blockFactoryin interfaceBlock
-
closeInternal
protected void closeInternal()Description copied from class:AbstractNonThreadSafeRefCountedThis is called when the number of references reaches zero. This is where resources should be released (adjusting circuit breakers if needed).- Specified by:
closeInternalin classAbstractNonThreadSafeRefCounted
-
deepCopy
Description copied from interface:BlockMake a deep copy of thisBlockusing the providedBlockFactory, likely copying all data. -
filter
Description copied from interface:BlockCreates a new block that only exposes the positions provided. -
slice
Description copied from interface:BlockReturn a subset of thisBlockfrom positionbeginInclusiveto positionendExclusive. This may return the same instance if the range covers all positions, but if it does it willRefCounted.incRef()it.NOTE: Implementations will not try to optimize zero length slices as we expect them to be rare.
-
getPositionCount
public int getPositionCount()Description copied from interface:BlockReturns the number of positions (rows) in this block. See class javadoc for the usual way to iterate these positions.- Specified by:
getPositionCountin interfaceBlock- Returns:
- the number of positions (rows) in this block
-
keepMask
Description copied from interface:Block -
ramBytesUsed
public long ramBytesUsed()- Specified by:
ramBytesUsedin interfaceorg.apache.lucene.util.Accountable
-