Class IndexEntry


  • @API(MAINTAINED)
    public class IndexEntry
    extends Object
    An IndexEntry carries around the key and value read from an index (as the name would imply). Further, if the key and value were produced by applying an index key expression to a record, this will carry around additional information about the nulls contained in the expression.
    • Method Detail

      • getIndex

        @Nonnull
        public Index getIndex()
        Get the index associated with this entry. This entry was either created in order to store within this index or it was constructed from reading this index.
        Returns:
        the index associated with this entry
      • getKey

        @Nonnull
        public Tuple getKey()
        Get the key portion of the index entry. This is stored in the key portion of the key-value pair in the database. Index entries are generally sorted by key, and this key must be unique for all entries in an index. As a result, it generally contains the primary key of its associated record as a sub-component.
        Returns:
        the key portion of the index entry
        See Also:
        getPrimaryKey()
      • getValue

        @Nonnull
        public Tuple getValue()
        Get the value portion of the index entry. This is stored in the value portion of the key-value pair in the database. Index entries are not sorted by value, but the user might configure indexes to have additional fields in the index value in order to increase the number of queries that can be satisfied without needing to resolve the underlying record.
        Returns:
        the value portion of the index entry
      • getKeySize

        public int getKeySize()
      • getPrimaryKey

        @Nonnull
        public Tuple getPrimaryKey()
        Get the primary key of the record associated with this entry. Note that some indexes, such as the atomic mutation indexes, erase the primary key information from the indexes they store. In that case, this method might not return a reasonable result.
        Returns:
        the primary key of the record that produced this index entry
      • getKeyValue

        @Nullable
        public Object getKeyValue​(int idx)
        Get a tuple element of the key tuple.
        Parameters:
        idx - the index of the desired element
        Returns:
        the tuple element at index idx
      • validateInIndex

        @API(INTERNAL)
        public void validateInIndex​(@Nonnull
                                    Index index)
        Validate that this entry is associated with the given index.
        Parameters:
        index - the index this entry should be a member of
      • keyContainsNonUniqueNull

        public boolean keyContainsNonUniqueNull()
        Returns true if the key expression contains a NULL value that is not a Key.Evaluated.NullStandin.NULL_UNIQUE value. Calling this method on a IndexEntry that was created directly from tuples will result in an exception.
        Returns:
        true if the key contains a non-unique null value
      • getKeyNullType

        @Nonnull
        public Key.Evaluated.NullStandin getKeyNullType​(int idx)
        Get the type of null stored in a given key index location. Calling this method on an IndexEntry that was created directly from tuples, or if the value at idx is not null, will result in an exception.
        Parameters:
        idx - the index of a null element
        Returns:
        the type of null stored at idx
      • subKey

        @Nonnull
        public IndexEntry subKey​(int startIdx,
                                 int endIdx)
        Produces a new IndexEntry whose key is a subset of this IndexEntry.
        Parameters:
        startIdx - the starting offset of the key to use for the new value
        endIdx - the ending offset (exclusive) of the key to use for the new value
        Returns:
        a new index entry with the subset key between startIdx and endIdx
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object