Module org.elasticsearch.compute
Package org.elasticsearch.compute.data
Class ExponentialHistogramArrayBlock
java.lang.Object
org.elasticsearch.compute.data.AbstractNonThreadSafeRefCounted
org.elasticsearch.compute.data.AbstractDelegatingCompoundBlock<ExponentialHistogramBlock>
org.elasticsearch.compute.data.ExponentialHistogramArrayBlock
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.lucene.util.Accountable,Writeable,Block,ExponentialHistogramBlock,HistogramBlock,RefCounted,Releasable,BlockLoader.Block
public final class ExponentialHistogramArrayBlock
extends AbstractDelegatingCompoundBlock<ExponentialHistogramBlock>
implements ExponentialHistogramBlock
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordNested classes/interfaces inherited from class org.elasticsearch.compute.data.AbstractDelegatingCompoundBlock
AbstractDelegatingCompoundBlock.AbstractCompositeBlockBuilder<T extends Block>, AbstractDelegatingCompoundBlock.Deserializer<T extends Block>Nested classes/interfaces inherited from interface org.elasticsearch.compute.data.Block
Block.Builder, Block.MvOrderingNested classes/interfaces inherited from interface org.elasticsearch.compute.data.ExponentialHistogramBlock
ExponentialHistogramBlock.Builder, ExponentialHistogramBlock.SerializedInput, ExponentialHistogramBlock.SerializedOutputNested classes/interfaces inherited from interface org.elasticsearch.compute.data.HistogramBlock
HistogramBlock.ComponentNested 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 -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanasVector()Returns an efficient dense single-value view of this block.protected ExponentialHistogramArrayBlockbuildFromSubBlocks(List<Block> subBlocks, int newPositionCount, int[] newFirstValueIndexes) 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 ExponentialHistogramBlockcreateConstant(ExponentialHistogram histogram, int positionCount, BlockFactory blockFactory) Returns the element type of this block.encode(int scale, BucketIterator negativeBuckets, BucketIterator positiveBuckets, double zeroThreshold, long zeroCount, long count, double sum, double min, double max) encode(ExponentialHistogram histogram) booleanexpand()Expand multivalued fields into one row per value.getExponentialHistogram(int valueIndex, ExponentialHistogramScratch scratch) Returns theExponentialHistogramvalue at the given index.inthashCode()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.readFrom(BlockStreamInput input) voidserializeExponentialHistogram(int valueIndex, ExponentialHistogramBlock.SerializedOutput out, org.apache.lucene.util.BytesRef scratch) Serializes the exponential histogram at the given index into the provided output, so that it can be read back viaExponentialHistogramBlockBuilder.deserializeAndAppend(SerializedInput).intReturns the maximum byte size of any single value in this block.voidwriteTo(StreamOutput out) Writes only the data of the block to a stream output.Methods inherited from class org.elasticsearch.compute.data.AbstractDelegatingCompoundBlock
allowPassingToDifferentDriver, areAllValuesNull, blockFactory, closeInternal, deepCopy, doesHaveMultivaluedFields, filter, getFirstValueIndex, getPositionCount, getTotalValueCount, getValueCount, isNull, keepMask, layoutEquals, mayHaveMultivaluedFields, mayHaveNulls, mvOrdering, ramBytesUsed, readFrom, slice, writeMultiValueMetadataMethods inherited from class org.elasticsearch.compute.data.AbstractNonThreadSafeRefCounted
attachReleasable, 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, areAllValuesNull, attachReleasable, blockFactory, deepCopy, doesHaveMultivaluedFields, filter, filter, getFirstValueIndex, getPositionCount, getTotalValueCount, getValueCount, insertNulls, isNull, isReleased, keepMask, mayHaveMultivaluedFields, mayHaveNulls, mvDeduplicated, mvOrdering, mvSortedAscending, sliceMethods inherited from interface org.elasticsearch.core.RefCounted
decRef, hasReferences, incRef, mustIncRef, tryIncRefMethods inherited from interface org.elasticsearch.core.Releasable
close
-
Method Details
-
assertInvariants
protected boolean assertInvariants()- Overrides:
assertInvariantsin classAbstractDelegatingCompoundBlock<ExponentialHistogramBlock>
-
getSubBlocks
- Specified by:
getSubBlocksin classAbstractDelegatingCompoundBlock<ExponentialHistogramBlock>- Returns:
- a list of the sub-blocks composing this compound block. The first block must be non-null for
non-null composite values (used for null detection). The order should match the order expected
by
AbstractDelegatingCompoundBlock.buildFromSubBlocks(List, int, int[]).
-
buildFromSubBlocks
protected ExponentialHistogramArrayBlock buildFromSubBlocks(List<Block> subBlocks, int newPositionCount, @Nullable int[] newFirstValueIndexes) Description copied from class:AbstractDelegatingCompoundBlockConstruct a new instance of the block, based on the given list of sub-blocks.- Specified by:
buildFromSubBlocksin classAbstractDelegatingCompoundBlock<ExponentialHistogramBlock>- Parameters:
subBlocks- List of sub-blocks, in the same order asAbstractDelegatingCompoundBlock.getSubBlocks()newPositionCount- the number of positions in the new blocknewFirstValueIndexes- the firstValueIndexes array for the new block (may be null for single-valued)- Returns:
- a new instance based on the given blocks.
-
encode
public static ExponentialHistogramArrayBlock.EncodedHistogramData encode(ExponentialHistogram histogram) -
encode
public static ExponentialHistogramArrayBlock.EncodedHistogramData encode(int scale, BucketIterator negativeBuckets, BucketIterator positiveBuckets, double zeroThreshold, long zeroCount, long count, double sum, double min, double max) -
getExponentialHistogram
public ExponentialHistogram getExponentialHistogram(int valueIndex, ExponentialHistogramScratch scratch) Description copied from interface:ExponentialHistogramBlockReturns theExponentialHistogramvalue at the given index. In order to be allocation free, this method requires a scratch object to be passed in, whose memory will be used to hold the state of the returned histogram. Therefore, the return value of this method is only valid until either the block is closed or the same scratch instance is passed to another call to this method on any block.- Specified by:
getExponentialHistogramin interfaceExponentialHistogramBlock- Parameters:
valueIndex- the index of the histogram to getscratch- the scratch to use as storage for the returned histogram- Returns:
- the exponential histogram at the given index
-
createConstant
public static ExponentialHistogramBlock createConstant(ExponentialHistogram histogram, int positionCount, BlockFactory blockFactory) -
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
-
serializeExponentialHistogram
public void serializeExponentialHistogram(int valueIndex, ExponentialHistogramBlock.SerializedOutput out, org.apache.lucene.util.BytesRef scratch) Description copied from interface:ExponentialHistogramBlockSerializes the exponential histogram at the given index into the provided output, so that it can be read back viaExponentialHistogramBlockBuilder.deserializeAndAppend(SerializedInput).- Specified by:
serializeExponentialHistogramin interfaceExponentialHistogramBlock- Parameters:
valueIndex-out-scratch-
-
valueMaxByteSize
public int valueMaxByteSize()Description copied from interface:BlockReturns the maximum byte size of any single value in this block. For fixed-width types this is a constant. ForBytesRef, this scans all values quickly.- Specified by:
valueMaxByteSizein interfaceBlock- Overrides:
valueMaxByteSizein classAbstractDelegatingCompoundBlock<ExponentialHistogramBlock>- Returns:
- the maximum byte size of any single value in this block
-
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. -
elementType
Description copied from interface:BlockReturns the element type of this block.- Specified by:
elementTypein interfaceBlock- Returns:
- the element type of this block
-
lookup
public 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. -
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. -
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
-
equals
-
hashCode
public int hashCode()
-