Module org.elasticsearch.compute
Class BatchEncoder
java.lang.Object
org.elasticsearch.compute.operator.mvdedupe.BatchEncoder
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.lucene.util.Accountable,org.elasticsearch.core.Releasable
- Direct Known Subclasses:
BatchEncoder.DirectEncoder,BatchEncoder.MVEncoder
public abstract class BatchEncoder
extends Object
implements org.elasticsearch.core.Releasable, org.apache.lucene.util.Accountable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected static classstatic interfaceDecodes values encoded byBatchEncoder.protected static final classprotected static final classprotected static final classprotected static classprotected static final classprotected static final classprotected static final classprotected static classprotected static classstatic interfaceChecks if an offset isnull.protected static classprotected static class -
Field Summary
Fields inherited from interface org.apache.lucene.util.Accountable
NULL_ACCOUNTABLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic BatchEncoder.Decoderdecoder(ElementType elementType) Get aBatchEncoder.Decoderfor the providedElementType.abstract voidEncodes the next batch of entries.abstract intThe number of positions in the current batch.abstract intread(int index, org.apache.lucene.util.BytesRefBuilder dst) Read the value at the specified index then append to thedst.abstract intvalueCount(int positionOffset) The number of values at the position with this offset in the batch.Methods 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
getChildResources, ramBytesUsedMethods inherited from interface org.elasticsearch.core.Releasable
close
-
Constructor Details
-
BatchEncoder
public BatchEncoder()
-
-
Method Details
-
decoder
Get aBatchEncoder.Decoderfor the providedElementType. -
positionCount
public abstract int positionCount()The number of positions in the current batch. -
valueCount
public abstract int valueCount(int positionOffset) The number of values at the position with this offset in the batch. -
read
public abstract int read(int index, org.apache.lucene.util.BytesRefBuilder dst) Read the value at the specified index then append to thedst. 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.- Returns:
- the number of bytes has read
-
encodeNextBatch
public abstract 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.
-