Module org.elasticsearch.compute
Class BatchEncoder.MVEncoder
java.lang.Object
org.elasticsearch.compute.operator.mvdedupe.BatchEncoder
org.elasticsearch.compute.operator.mvdedupe.BatchEncoder.MVEncoder
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.lucene.util.Accountable,org.elasticsearch.core.Releasable
- Direct Known Subclasses:
BatchEncoder.Booleans,BatchEncoder.BytesRefs,BatchEncoder.Doubles,BatchEncoder.Ints,BatchEncoder.Longs
- Enclosing class:
BatchEncoder
-
Nested Class Summary
Nested classes/interfaces inherited from class org.elasticsearch.compute.operator.mvdedupe.BatchEncoder
BatchEncoder.Booleans, BatchEncoder.BytesRefs, BatchEncoder.Decoder, BatchEncoder.DirectBooleans, BatchEncoder.DirectBytesRefs, BatchEncoder.DirectDoubles, BatchEncoder.DirectEncoder, BatchEncoder.DirectInts, BatchEncoder.DirectLongs, BatchEncoder.DirectNulls, BatchEncoder.Doubles, BatchEncoder.Ints, BatchEncoder.IsNull, BatchEncoder.Longs, BatchEncoder.MVEncoder -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final org.apache.lucene.util.BytesRefBuilderBuffer into which we encode values.Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidImplementations ofreadNextBatch()should call this before adding each value to the current position to mark its start.final voidEncodes the next batch of entries.protected final voidImplementations ofreadNextBatch()should call this to encode an entirely null position.protected final voidImplementations ofreadNextBatch()should call this to end the current position.protected final intThe first position in the current batch.final intThe number of positions in the current batch.longfinal intread(int index, org.apache.lucene.util.BytesRefBuilder dst) Read the value at the specified index.protected abstract voidEncodes the next batch of values.protected final voidImplementations ofreadNextBatch()should call this before any values at the current position.final intvalueCount(int positionOffset) The number of values at the position with this offset in the batch.Methods inherited from class org.elasticsearch.compute.operator.mvdedupe.BatchEncoder
decoderMethods 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.core.Releasable
close
-
Field Details
-
bytes
protected final org.apache.lucene.util.BytesRefBuilder bytesBuffer into which we encode values.
-
-
Method Details
-
firstPosition
protected final int firstPosition()The first position in the current batch. -
positionCount
public final int positionCount()The number of positions in the current batch.- Specified by:
positionCountin classBatchEncoder
-
valueCount
public final int valueCount(int positionOffset) The number of values at the position with this offset in the batch. The actual position in the block we're encoding ispositionOffset + firstPosition().- Specified by:
valueCountin classBatchEncoder
-
read
public final int read(int index, org.apache.lucene.util.BytesRefBuilder dst) Read the value at the specified index. Values at the first position start at index0and advance one per value. So the values at position n start at(0..n-1).sum(valueCount). There is no random-access way to get the first index for a position.- Specified by:
readin classBatchEncoder- Returns:
- the number of bytes has read
-
encodeNextBatch
public final void encodeNextBatch()Encodes the next batch of entries. This will encode values until the next value doesn't fit into the buffer. Callers should iterate on the values that have been encoded and then call this again for the next batch.It's possible for this batch to be empty if there isn't room for the first entry in the buffer. If so, call again to force the buffer to expand and encode that entry.
- Specified by:
encodeNextBatchin classBatchEncoder
-
ramBytesUsed
public long ramBytesUsed() -
readNextBatch
protected abstract void readNextBatch()Encodes the next batch of values. SeeencodeNextBatch(). -
startPosition
protected final void startPosition()Implementations ofreadNextBatch()should call this before any values at the current position. -
addingValue
protected final void addingValue()Implementations ofreadNextBatch()should call this before adding each value to the current position to mark its start. -
endPosition
protected final void endPosition()Implementations ofreadNextBatch()should call this to end the current position. -
encodeNull
protected final void encodeNull()Implementations ofreadNextBatch()should call this to encode an entirely null position.
-