Class NullableInlineIndexKeyType<T extends IndexKey>
- java.lang.Object
-
- org.apache.ignite.internal.cache.query.index.sorted.inline.types.NullableInlineIndexKeyType<T>
-
- All Implemented Interfaces:
InlineIndexKeyType
- Direct Known Subclasses:
BytesInlineIndexKeyType,DateInlineIndexKeyType,NumericInlineIndexKeyType,ObjectByteArrayInlineIndexKeyType,ObjectHashInlineIndexKeyType,StringInlineIndexKeyType,StringNoCompareInlineIndexKeyType,TimeInlineIndexKeyType,TimestampInlineIndexKeyType,UuidInlineIndexKeyType
public abstract class NullableInlineIndexKeyType<T extends IndexKey> extends Object implements InlineIndexKeyType
Abstract inline key. Store base logic for work with inlined keys. Handle NULL values.
-
-
Field Summary
Fields Modifier and Type Field Description static intCANT_BE_COMPAREValue for comparison meaning 'Not enough information to compare'.static intCOMPARE_UNSUPPORTEDValue for comparison meaning 'Compare not supported for given value'.protected shortkeySizeActual size of a key without type field.static intVARTYPE_HEADER_SIZESize of header for vartypes inlined values.
-
Constructor Summary
Constructors Modifier Constructor Description protectedNullableInlineIndexKeyType(IndexKeyType type, short keySize)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intcompare(long pageAddr, int off, int maxSize, IndexKey key)Compares inlined and given value.abstract intcompare0(long pageAddr, int off, IndexKey v)Compares inlined and given value.IndexKeyget(long pageAddr, int off, int maxSize)Restores value from inline, if possible.protected abstract Tget0(long pageAddr, int off)Restores value from inline.booleaninlinedFullValue(long pageAddr, int off, int maxSize)Whether inline contains full index key.intinlineSize()Returns size of inlined key.intinlineSize(long pageAddr, int off)Actual size of inline value.intinlineSize(IndexKey key)Returns inline size for specified key.protected abstract intinlineSize0(T key)Return inlined size for specified key.BooleanisNull(long pageAddr, int off, int maxSize)Checks if inlined index key is null.shortkeySize()intput(long pageAddr, int off, IndexKey key, int maxSize)Puts given value into inline index tree.protected abstract intput0(long pageAddr, int off, T val, int maxSize)Puts given value into inline index tree.static byte[]readBytes(long pageAddr, int off)Read variable length bytearrayIndexKeyTypetype()Returns type of inlined column.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.internal.cache.query.index.sorted.inline.InlineIndexKeyType
isComparableTo
-
-
-
-
Field Detail
-
CANT_BE_COMPARE
public static final int CANT_BE_COMPARE
Value for comparison meaning 'Not enough information to compare'.- See Also:
- Constant Field Values
-
COMPARE_UNSUPPORTED
public static final int COMPARE_UNSUPPORTED
Value for comparison meaning 'Compare not supported for given value'.- See Also:
- Constant Field Values
-
VARTYPE_HEADER_SIZE
public static final int VARTYPE_HEADER_SIZE
Size of header for vartypes inlined values.- See Also:
- Constant Field Values
-
keySize
protected final short keySize
Actual size of a key without type field.
-
-
Constructor Detail
-
NullableInlineIndexKeyType
protected NullableInlineIndexKeyType(IndexKeyType type, short keySize)
- Parameters:
type- Index key type.keySize- Size of value stored in the key.
-
-
Method Detail
-
type
public IndexKeyType type()
Returns type of inlined column.- Specified by:
typein interfaceInlineIndexKeyType- Returns:
- Column's value type.
-
inlineSize
public int inlineSize(long pageAddr, int off)Actual size of inline value. It returns keySize() + 1 for values with fixed size and amount of written bytes for values with variable length. Used for dynamic offset calculation by page for variable length values.- Specified by:
inlineSizein interfaceInlineIndexKeyType- Parameters:
pageAddr- Page address.off- Offset.- Returns:
- Returns actual size of inlined value.
-
inlineSize
public int inlineSize()
Returns size of inlined key. Note: system fields (e.g. type, length) are taken into account as well.- Specified by:
inlineSizein interfaceInlineIndexKeyType
-
inlineSize
public int inlineSize(IndexKey key)
Returns inline size for specified key. Note: system fields (e.g. type, length) are taken into account as well.- Specified by:
inlineSizein interfaceInlineIndexKeyType
-
get
public IndexKey get(long pageAddr, int off, int maxSize)
Restores value from inline, if possible.- Specified by:
getin interfaceInlineIndexKeyType- Parameters:
pageAddr- Address of the page.off- Offset on the page.maxSize- Max size to read.- Returns:
- Restored value or
nullif value can't be restored.
-
isNull
public Boolean isNull(long pageAddr, int off, int maxSize)
Checks if inlined index key is null.- Specified by:
isNullin interfaceInlineIndexKeyType- Parameters:
pageAddr- Page address.off- Offset.maxSize- Remaining inlined buffer size (max available bytes to read for the current row).- Returns:
Boolean.TRUEif index key is null,Boolean.FALSEif index key is not null,nullif can't say for sure.
-
put
public int put(long pageAddr, int off, IndexKey key, int maxSize)Puts given value into inline index tree.- Specified by:
putin interfaceInlineIndexKeyType- Parameters:
pageAddr- Page address.off- Offset.key- Index key.maxSize- Remaining inlined buffer size (max available bytes to write for the current row).- Returns:
- Amount of bytes actually stored.
-
keySize
public short keySize()
- Specified by:
keySizein interfaceInlineIndexKeyType- Returns:
- Size of key, in bytes.
-1means variable length of key.
-
put0
protected abstract int put0(long pageAddr, int off, T val, int maxSize)Puts given value into inline index tree.- Parameters:
pageAddr- Page address.off- Offset.val- Value.maxSize- Max size.- Returns:
- Amount of bytes actually stored.
-
get0
protected abstract T get0(long pageAddr, int off)
Restores value from inline.- Parameters:
pageAddr- Page address.off- Offset.- Returns:
- Inline value.
-
readBytes
public static byte[] readBytes(long pageAddr, int off)Read variable length bytearray
-
compare
public int compare(long pageAddr, int off, int maxSize, IndexKey key)Compares inlined and given value.- Specified by:
comparein interfaceInlineIndexKeyType- Parameters:
pageAddr- Page address.off- Offset.maxSize- Remaining inlined buffer size (max available bytes to read for the current row).key- Value that should be compare.- Returns:
- -1, 0 or 1 if inlined value less, equal or greater than given respectively, or -2 if inlined part is not enough to compare.
-
compare0
public abstract int compare0(long pageAddr, int off, IndexKey v)Compares inlined and given value.- Parameters:
pageAddr- Page address.off- Offset.v- Value that should be compare.- Returns:
- -1, 0 or 1 if inlined value less, equal or greater
than given respectively,
CANT_BE_COMPAREif inlined part is not enough to compare, orCOMPARE_UNSUPPORTEDif given value can't be compared with inlined part at all.
-
inlineSize0
protected abstract int inlineSize0(T key)
Return inlined size for specified key.
-
inlinedFullValue
public boolean inlinedFullValue(long pageAddr, int off, int maxSize)Whether inline contains full index key.- Specified by:
inlinedFullValuein interfaceInlineIndexKeyType- Parameters:
pageAddr- Page address.off- Offset.maxSize- Remaining inlined buffer size (max available bytes to read for the current row).- Returns:
trueif inline contains full index key. Can befalsefor truncated variable length types.
-
-