Class NullableInlineIndexKeyType<T extends IndexKey>

    • 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

      • 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:
        inlineSize in interface InlineIndexKeyType
        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:
        inlineSize in interface InlineIndexKeyType
      • 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:
        inlineSize in interface InlineIndexKeyType
      • get

        public IndexKey get​(long pageAddr,
                            int off,
                            int maxSize)
        Restores value from inline, if possible.
        Specified by:
        get in interface InlineIndexKeyType
        Parameters:
        pageAddr - Address of the page.
        off - Offset on the page.
        maxSize - Max size to read.
        Returns:
        Restored value or null if value can't be restored.
      • isNull

        public Boolean isNull​(long pageAddr,
                              int off,
                              int maxSize)
        Checks if inlined index key is null.
        Specified by:
        isNull in interface InlineIndexKeyType
        Parameters:
        pageAddr - Page address.
        off - Offset.
        maxSize - Remaining inlined buffer size (max available bytes to read for the current row).
        Returns:
        Boolean.TRUE if index key is null, Boolean.FALSE if index key is not null, null if 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:
        put in interface InlineIndexKeyType
        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:
        keySize in interface InlineIndexKeyType
        Returns:
        Size of key, in bytes. -1 means 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:
        compare in interface InlineIndexKeyType
        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_COMPARE if inlined part is not enough to compare, or COMPARE_UNSUPPORTED if 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:
        inlinedFullValue in interface InlineIndexKeyType
        Parameters:
        pageAddr - Page address.
        off - Offset.
        maxSize - Remaining inlined buffer size (max available bytes to read for the current row).
        Returns:
        true if inline contains full index key. Can be false for truncated variable length types.