Package org.apache.druid.segment.column
Class NullableTypeStrategy<T>
- java.lang.Object
-
- org.apache.druid.segment.column.NullableTypeStrategy<T>
-
- All Implemented Interfaces:
Comparator<T>
public final class NullableTypeStrategy<T> extends Object implements Comparator<T>
Wrapper ofTypeStrategy
for nullable types, which storesNullHandling.IS_NULL_BYTE
orNullHandling.IS_NOT_NULL_BYTE
in the leading byte of any value, as appropriate. If the value is null, onlyNullHandling.IS_NULL_BYTE
will be set, otherwise, the value bytes will be written after the null byte. layout: | null (byte) | value (byte[]) | This is not the most efficient way to track nulls, it is recommended to only use this wrapper if you MUST store null values.- See Also:
TypeStrategy
-
-
Constructor Summary
Constructors Constructor Description NullableTypeStrategy(TypeStrategy<T> delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(T o1, T o2)
int
estimateSizeBytes(T value)
T
read(ByteBuffer buffer)
T
read(ByteBuffer buffer, int offset)
boolean
readRetainsBufferReference()
Whether theread(java.nio.ByteBuffer)
methods return an object that may retain a reference to the providedByteBuffer
.int
write(ByteBuffer buffer, int offset, T value, int maxSizeBytes)
int
write(ByteBuffer buffer, T value, int maxSizeBytes)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Constructor Detail
-
NullableTypeStrategy
public NullableTypeStrategy(TypeStrategy<T> delegate)
-
-
Method Detail
-
read
@Nullable public T read(ByteBuffer buffer)
-
write
public int write(ByteBuffer buffer, @Nullable T value, int maxSizeBytes)
-
read
@Nullable public T read(ByteBuffer buffer, int offset)
-
readRetainsBufferReference
public boolean readRetainsBufferReference()
Whether theread(java.nio.ByteBuffer)
methods return an object that may retain a reference to the providedByteBuffer
. If a reference is sometimes retained, this method returns true. It returns false if, and only if, a reference is *never* retained.
-
write
public int write(ByteBuffer buffer, int offset, @Nullable T value, int maxSizeBytes)
-
compare
public int compare(T o1, T o2)
- Specified by:
compare
in interfaceComparator<T>
-
-