Package org.apache.druid.segment.data
Class FrontCodedIntArrayIndexedWriter
- java.lang.Object
-
- org.apache.druid.segment.data.FrontCodedIntArrayIndexedWriter
-
- All Implemented Interfaces:
DictionaryWriter<int[]>,Serializer
public class FrontCodedIntArrayIndexedWriter extends Object implements DictionaryWriter<int[]>
-
-
Field Summary
Fields Modifier and Type Field Description static Comparator<int[]>ARRAY_COMPARATOR
-
Constructor Summary
Constructors Constructor Description FrontCodedIntArrayIndexedWriter(SegmentWriteOutMedium segmentWriteOutMedium, ByteOrder byteOrder, int bucketSize)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int[]get(int index)intgetCardinality()longgetSerializedSize()Returns the number of bytes, that this Serializer will write to the output _channel_ (not smoosher) on aSerializer.writeTo(java.nio.channels.WritableByteChannel, org.apache.druid.java.util.common.io.smoosh.FileSmoosher)call.booleanisSorted()voidopen()voidwrite(int[] value)static intwriteBucket(ByteBuffer buffer, int[][] values, int numValues)Write bucket of values to aByteBuffer.voidwriteTo(WritableByteChannel channel, FileSmoosher smoosher)Writes serialized form of this object to the given channel.static intwriteValue(ByteBuffer buffer, int[] ints)Write a variable length int[] value to aByteBuffer, storing the length as aVByteencoded integer followed by the value itself.
-
-
-
Field Detail
-
ARRAY_COMPARATOR
public static final Comparator<int[]> ARRAY_COMPARATOR
-
-
Constructor Detail
-
FrontCodedIntArrayIndexedWriter
public FrontCodedIntArrayIndexedWriter(SegmentWriteOutMedium segmentWriteOutMedium, ByteOrder byteOrder, int bucketSize)
-
-
Method Detail
-
open
public void open() throws IOException- Specified by:
openin interfaceDictionaryWriter<int[]>- Throws:
IOException
-
write
public void write(@Nullable int[] value) throws IOException
- Specified by:
writein interfaceDictionaryWriter<int[]>- Throws:
IOException
-
getSerializedSize
public long getSerializedSize() throws IOExceptionDescription copied from interface:SerializerReturns the number of bytes, that this Serializer will write to the output _channel_ (not smoosher) on aSerializer.writeTo(java.nio.channels.WritableByteChannel, org.apache.druid.java.util.common.io.smoosh.FileSmoosher)call.- Specified by:
getSerializedSizein interfaceSerializer- Throws:
IOException
-
writeTo
public void writeTo(WritableByteChannel channel, FileSmoosher smoosher) throws IOException
Description copied from interface:SerializerWrites serialized form of this object to the given channel. If parallel data streams are needed, they could be created with the provided smoosher.- Specified by:
writeToin interfaceSerializer- Throws:
IOException
-
isSorted
public boolean isSorted()
- Specified by:
isSortedin interfaceDictionaryWriter<int[]>
-
get
@Nullable public int[] get(int index) throws IOException
- Specified by:
getin interfaceDictionaryWriter<int[]>- Throws:
IOException
-
getCardinality
public int getCardinality()
- Specified by:
getCardinalityin interfaceDictionaryWriter<int[]>
-
writeBucket
public static int writeBucket(ByteBuffer buffer, int[][] values, int numValues)
Write bucket of values to aByteBuffer. The first value is written completely, subsequent values are written with an integer to indicate how much of the first value in the bucket is a prefix of the value, followed by the remaining bytes of the value. UsesVByteencoded integers to indicate prefix length and value length.
-
writeValue
public static int writeValue(ByteBuffer buffer, int[] ints)
Write a variable length int[] value to aByteBuffer, storing the length as aVByteencoded integer followed by the value itself. Returns the number of bytes written to the buffer. This method returns a negative value if there is no room available in the buffer, so that it can be grown if needed.
-
-