Class UniqueWithDuplicateNullsIndexSortObserver

  • All Implemented Interfaces:
    SortObserver

    public class UniqueWithDuplicateNullsIndexSortObserver
    extends BasicSortObserver
    UniqueWithDuplicateNullsIndexSortObserver is implementation of BasicSortObserver for eliminating non null duplicates from the backing index of unique constraint. This class is implemented to check for special case of distinct sorting where duplicate keys are allowed only if there is a null in the key part.
    • Field Detail

      • indexOrConstraintName

        private final java.lang.String indexOrConstraintName
      • tableName

        private final java.lang.String tableName
      • deferrable

        private final boolean deferrable
      • deferred

        private final boolean deferred
      • constraintId

        private final UUID constraintId
    • Constructor Detail

      • UniqueWithDuplicateNullsIndexSortObserver

        public UniqueWithDuplicateNullsIndexSortObserver​(LanguageConnectionContext lcc,
                                                         UUID constraintId,
                                                         boolean doClone,
                                                         boolean deferrable,
                                                         boolean deferred,
                                                         java.lang.String indexOrConstraintName,
                                                         ExecRow execRow,
                                                         boolean reuseWrappers,
                                                         java.lang.String tableName)
        Constructs an object of UniqueWithDuplicateNullsIndexSortObserver
        Parameters:
        lcc - Language Connection context
        constraintId - Id of the constraint (only used for deferrable constraints)
        doClone - If true, then rows that are retained by the sorter will be cloned. This is needed if language is reusing row wrappers.
        deferrable - deferrable constraint
        deferred - constraint mode is deferred
        indexOrConstraintName - name of index of constraint
        execRow - ExecRow to use as source of clone for store.
        reuseWrappers - Whether or not we can reuse the wrappers
        tableName - name of the table
    • Method Detail

      • deferred

        public boolean deferred()
        Description copied from interface: SortObserver
        Overridden by subclasses that observe sorters with uniqueness checking.
        Specified by:
        deferred in interface SortObserver
        Overrides:
        deferred in class BasicSortObserver
        Returns:
        true if constraint mode of the index's constraint is effectively deferred. Any SortObserver implementations that implement uniqueness checking need to keep track of this information.
      • deferrable

        public boolean deferrable()
        Description copied from interface: SortObserver
        Overridden by subclasses that observe sorters with uniqueness checking.
        Specified by:
        deferrable in interface SortObserver
        Overrides:
        deferrable in class BasicSortObserver
        Returns:
        true if the index's constraint is deferrable. Any SortObserver implementations that implement uniqueness checking need to keep track of this information.
      • rememberDuplicate

        public void rememberDuplicate​(DataValueDescriptor[] row)
                               throws StandardException
        Description copied from interface: SortObserver
        Overridden by subclasses that observe sorters with uniqueness checking. Will be called by sorters iff deferrable() and deferred() and uniqueness violation, so implementations that sometimes return true to these must implement this method to save duplicate information till commit time.
        Specified by:
        rememberDuplicate in interface SortObserver
        Overrides:
        rememberDuplicate in class BasicSortObserver
        Parameters:
        row - data of offending key
        Throws:
        StandardException - standard error policy