- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.lucene.util.Accountable,Writeable,Block,HistogramBlock,TDigestBlock,org.elasticsearch.core.RefCounted,org.elasticsearch.core.Releasable,BlockLoader.Block
-
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.compute.data.HistogramBlock
HistogramBlock.ComponentNested classes/interfaces inherited from interface org.elasticsearch.compute.data.TDigestBlock
TDigestBlock.Builder, TDigestBlock.SerializedTDigestInput, TDigestBlock.SerializedTDigestOutputNested 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
ConstructorsConstructorDescriptionTDigestArrayBlock(BytesRefBlock encodedDigests, DoubleBlock minima, DoubleBlock maxima, DoubleBlock sums, LongBlock valueCounts) -
Method Summary
Modifier and TypeMethodDescriptionbooleanasVector()Returns an efficient dense single-value view of this block.protected TDigestArrayBlockbuildFromSubBlocks(List<Block> subBlocks) Construct a new instance of the block, based on the given list of sub-blocks.Returns a block holding the specified component of the histogram at each position.static TDigestBlockcreateConstant(TDigestHolder histogram, int positionCount, BlockFactory blockFactory) booleanDoes this block have multivalued fields? UnlikeBlock.mayHaveMultivaluedFields()this will never return a false positive.Returns the element type of this block.booleanexpand()Expand multivalued fields into one row per value.intgetFirstValueIndex(int position) Returns the index of the first value for the given position.getTDigestHolder(int offset, TDigestHolder scratch) intReturns the total number of values in this block not counting nulls.intgetValueCount(int position) Returns the number of values for the given position.inthashCode()booleanisNull(int position) org.elasticsearch.core.ReleasableIterator<? extends Block> lookup(IntBlock positions, ByteSizeValue targetBlockSize) Builds an Iterator of newBlocks with the sameBlock.elementType()as this Block whose values are copied from positions in this Block.booleanCan this block have multivalued fields? Blocks that returnfalsewill never return more than one fromBlock.getValueCount(int).booleanHow are multivalued fields ordered?static TDigestArrayBlockvoidserializeTDigest(int valueIndex, TDigestBlock.SerializedTDigestOutput out, org.apache.lucene.util.BytesRef scratch) voidwriteTo(StreamOutput out) Writes only the data of the block to a stream output.Methods inherited from class org.elasticsearch.compute.data.AbstractDelegatingCompoundBlock
allowPassingToDifferentDriver, blockFactory, closeInternal, deepCopy, filter, getPositionCount, keepMask, ramBytesUsed, sliceMethods inherited from class org.elasticsearch.compute.data.AbstractNonThreadSafeRefCounted
close, decRef, hasReferences, incRef, isReleased, tryIncRefMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.util.Accountable
getChildResources, ramBytesUsedMethods inherited from interface org.elasticsearch.compute.data.Block
allowPassingToDifferentDriver, blockFactory, deepCopy, filter, getPositionCount, insertNulls, isReleased, keepMask, mvDeduplicated, mvSortedAscending, sliceMethods inherited from interface org.elasticsearch.core.RefCounted
decRef, hasReferences, incRef, mustIncRef, tryIncRefMethods inherited from interface org.elasticsearch.core.Releasable
close
-
Constructor Details
-
TDigestArrayBlock
public TDigestArrayBlock(BytesRefBlock encodedDigests, DoubleBlock minima, DoubleBlock maxima, DoubleBlock sums, LongBlock valueCounts)
-
-
Method Details
-
getSubBlocks
- Specified by:
getSubBlocksin classAbstractDelegatingCompoundBlock<TDigestBlock>- Returns:
- a list of the sub-blocks composing this compound block. The order of the list should match the order
expected by
AbstractDelegatingCompoundBlock.buildFromSubBlocks(List)
-
buildFromSubBlocks
Description copied from class:AbstractDelegatingCompoundBlockConstruct a new instance of the block, based on the given list of sub-blocks.- Specified by:
buildFromSubBlocksin classAbstractDelegatingCompoundBlock<TDigestBlock>- Parameters:
subBlocks- List of sub-blocks, in the same order asAbstractDelegatingCompoundBlock.getSubBlocks()- Returns:
- a new instance based on the given blocks.
-
asVector
Description copied from interface:BlockReturns an efficient dense single-value view of this block. Null, if the block is not dense single-valued. That is, if mayHaveNulls returns true, or getTotalValueCount is not equal to getPositionCount. -
getFirstValueIndex
public int getFirstValueIndex(int position) Description copied from interface:BlockReturns the index of the first value for the given position. See class javadoc for the usual way to iterate these positions.For densely packed data this will return its parameter unchanged. For fields with
nullvalues or multivalued fields, this will shift. Here's an example:0 <---+ 1 | Values at first position 2 | 3 <---+ 5 <---- Value at second position 6 <---+ Values at third position 7 <---+This represents three rows. The first has the value
[0, 1, 2, 3]. The second has the value5. The third has the value[6, 7]. This method will return0for the first position,4for the second, and5for the third.- Specified by:
getFirstValueIndexin interfaceBlock- Returns:
- the index of the first value for the given position
-
getTotalValueCount
public int getTotalValueCount()Description copied from interface:BlockReturns the total number of values in this block not counting nulls. This powers theCOUNTaggregation and is used to report the number of fields loaded by ESQL.- Specified by:
getTotalValueCountin interfaceBlock- Returns:
- the total number of values in this block not counting nulls
-
getValueCount
public int getValueCount(int position) Description copied from interface:BlockReturns the number of values for the given position. See class javadoc for the usual way to iterate these positions.For densely packed data this will return
1. Fornulls this will return0. For multivalued fields, this will return the number of values. Here's an example:0 <---+ 1 | Values at first position 2 | 3 <---+ 5 <---- Value at second position 6 <---+ Values at third position 7 <---+This represents three rows. The first has the value
[0, 1, 2, 3]. The second has the value5. The third has the value[6, 7]. This method will return4for the first position,1for the second, and2for the third.- Specified by:
getValueCountin interfaceBlock- Returns:
- the number of values for the given position
-
elementType
Description copied from interface:BlockReturns the element type of this block.- Specified by:
elementTypein interfaceBlock- Returns:
- the element type of this block
-
isNull
public boolean isNull(int position) -
mayHaveNulls
public boolean mayHaveNulls()- Specified by:
mayHaveNullsin interfaceBlock- Returns:
- true if some values might be null. False, if all values are guaranteed to be not null.
-
areAllValuesNull
public boolean areAllValuesNull()- Specified by:
areAllValuesNullin interfaceBlock- Returns:
- true if all values in this block are guaranteed to be null.
-
mayHaveMultivaluedFields
public boolean mayHaveMultivaluedFields()Description copied from interface:BlockCan this block have multivalued fields? Blocks that returnfalsewill never return more than one fromBlock.getValueCount(int). This may returntruefor Blocks that do not have multivalued fields, but it will always answer quickly.- Specified by:
mayHaveMultivaluedFieldsin interfaceBlock
-
doesHaveMultivaluedFields
public boolean doesHaveMultivaluedFields()Description copied from interface:BlockDoes this block have multivalued fields? UnlikeBlock.mayHaveMultivaluedFields()this will never return a false positive. In other words, if this returnstruethen there are positions for whichBlock.getValueCount(int)will return more than 1. This will answer quickly if it can but may have to check all positions.- Specified by:
doesHaveMultivaluedFieldsin interfaceBlock
-
lookup
public org.elasticsearch.core.ReleasableIterator<? extends Block> lookup(IntBlock positions, ByteSizeValue targetBlockSize) Description copied from interface:BlockBuilds an Iterator of newBlocks with the sameBlock.elementType()as this Block whose values are copied from positions in this Block. It has the same number ofpositionsas thepositionsparameter.For example, if this block contained
[a, b, [b, c]]and were called with the block[0, 1, 1, [1, 2]]then the result would be[a, b, b, [b, b, c]].This process produces
count(this) * count(positions)values per positions which could be quite large. Instead of returning a single Block, this returns an Iterator of Blocks containing all of the promised values.The returned
ReleasableIteratormay retain a reference to thepositionsparameter. Close it to release those references.This block is built using the same
BlockFactoryas was used to build thepositionsparameter. -
mvOrdering
Description copied from interface:BlockHow are multivalued fields ordered?- Specified by:
mvOrderingin interfaceBlock
-
expand
Description copied from interface:BlockExpand multivalued fields into one row per value. Returns the same block if there aren't any multivalued fields to expand. The returned block needs to be closed by the caller to release the block's resources. -
buildHistogramComponentBlock
Description copied from interface:HistogramBlockReturns a block holding the specified component of the histogram at each position. The number of positions in the returned block will be exactly equal to the number of positions in this block. If a position is null in this block, it will also be null in the returned block.
The caller is responsible for closing the returned block.- Specified by:
buildHistogramComponentBlockin interfaceHistogramBlock- Parameters:
component- the component to extract- Returns:
- the block containing the specified component
-
writeTo
Description copied from interface:BlockWrites only the data of the block to a stream output. This method should be used when the type of the block is known during reading.- Specified by:
writeToin interfaceBlock- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
readFrom
- Throws:
IOException
-
serializeTDigest
public void serializeTDigest(int valueIndex, TDigestBlock.SerializedTDigestOutput out, org.apache.lucene.util.BytesRef scratch) - Specified by:
serializeTDigestin interfaceTDigestBlock
-
getTDigestHolder
- Specified by:
getTDigestHolderin interfaceTDigestBlock
-
createConstant
public static TDigestBlock createConstant(TDigestHolder histogram, int positionCount, BlockFactory blockFactory) -
equals
-
hashCode
public int hashCode()
-