Class Strong


  • public class Strong
    extends java.lang.Object
    Utilities for strong predicates.

    A predicate is strong (or null-rejecting) if it is UNKNOWN if any of its inputs is UNKNOWN.

    By the way, UNKNOWN is just the boolean form of NULL.

    Examples:

    • UNKNOWN is strong in [] (definitely null)
    • c = 1 is strong in [c] (definitely null if and only if c is null)
    • c IS NULL is not strong (always returns TRUE or FALSE, never null)
    • p1 AND p2 is strong in [p1, p2] (definitely null if either p1 is null or p2 is null)
    • p1 OR p2 is strong if p1 and p2 are strong
    • c1 = 1 OR c2 IS NULL is strong in [c1] (definitely null if c1 is null)
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Strong.Policy
      How whether an operator's operands are null affects whether a call to that operator evaluates to null.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.Map<SqlKind,​Strong.Policy> MAP  
    • Constructor Summary

      Constructors 
      Constructor Description
      Strong()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private boolean allNull​(java.util.List<RexNode> operands)
      Returns whether all expressions in a list are definitely null.
      private boolean anyNull​(java.util.List<RexNode> operands)
      Returns whether any expressions in a list are definitely null.
      private static java.util.Map<SqlKind,​Strong.Policy> createPolicyMap()  
      boolean isNotTrue​(RexNode node)
      Returns whether an expression is definitely not true.
      static boolean isNotTrue​(RexNode node, ImmutableBitSet nullColumns)
      Returns whether the analyzed expression will definitely not return true (equivalently, will definitely not return null or false) if all of a given set of input columns are null.
      boolean isNull​(RexInputRef ref)
      Returns whether a given input is definitely null.
      boolean isNull​(RexNode node)
      Returns whether an expression is definitely null.
      static boolean isNull​(RexNode node, ImmutableBitSet nullColumns)
      Returns whether the analyzed expression will definitely return null if all of a given set of input columns are null.
      static Strong of​(ImmutableBitSet nullColumns)
      Returns a checker that consults a bit set to find out whether particular inputs may be null.
      static Strong.Policy policy​(SqlKind kind)
      Returns how to deduce whether a particular kind of expression is null, given whether its arguments are null.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Strong

        public Strong()
    • Method Detail

      • of

        public static Strong of​(ImmutableBitSet nullColumns)
        Returns a checker that consults a bit set to find out whether particular inputs may be null.
      • isNull

        public static boolean isNull​(RexNode node,
                                     ImmutableBitSet nullColumns)
        Returns whether the analyzed expression will definitely return null if all of a given set of input columns are null.
      • isNotTrue

        public static boolean isNotTrue​(RexNode node,
                                        ImmutableBitSet nullColumns)
        Returns whether the analyzed expression will definitely not return true (equivalently, will definitely not return null or false) if all of a given set of input columns are null.
      • policy

        public static Strong.Policy policy​(SqlKind kind)
        Returns how to deduce whether a particular kind of expression is null, given whether its arguments are null.
      • isNotTrue

        public boolean isNotTrue​(RexNode node)
        Returns whether an expression is definitely not true.
      • isNull

        public boolean isNull​(RexInputRef ref)
        Returns whether a given input is definitely null.
      • allNull

        private boolean allNull​(java.util.List<RexNode> operands)
        Returns whether all expressions in a list are definitely null.
      • anyNull

        private boolean anyNull​(java.util.List<RexNode> operands)
        Returns whether any expressions in a list are definitely null.