Package org.apache.druid.segment.column
Class NullableTypeStrategy<T>
- java.lang.Object
-
- org.apache.druid.segment.column.NullableTypeStrategy<T>
-
- All Implemented Interfaces:
it.unimi.dsi.fastutil.Hash.Strategy<T>,Comparator<T>
public final class NullableTypeStrategy<T> extends Object implements Comparator<T>, it.unimi.dsi.fastutil.Hash.Strategy<T>
Wrapper ofTypeStrategyfor nullable types, which storesNullHandling.IS_NULL_BYTEorNullHandling.IS_NOT_NULL_BYTEin the leading byte of any value, as appropriate. If the value is null, onlyNullHandling.IS_NULL_BYTEwill 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 intcompare(T o1, T o2)booleanequals(T a, T b)intestimateSizeBytes(T value)booleangroupable()inthashCode(T o)Tread(ByteBuffer buffer)Tread(ByteBuffer buffer, int offset)booleanreadRetainsBufferReference()Whether theread(java.nio.ByteBuffer)methods return an object that may retain a reference to the providedByteBuffer.intwrite(ByteBuffer buffer, int offset, T value, int maxSizeBytes)intwrite(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
@CheckReturnValue 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
@CheckReturnValue public int write(ByteBuffer buffer, int offset, @Nullable T value, int maxSizeBytes)
-
compare
public int compare(T o1, T o2)
- Specified by:
comparein interfaceComparator<T>
-
groupable
public boolean groupable()
-
hashCode
public int hashCode(@Nullable T o)
- Specified by:
hashCodein interfaceit.unimi.dsi.fastutil.Hash.Strategy<T>
-
-