Class TupleDomain<T>


  • public final class TupleDomain<T>
    extends java.lang.Object
    Defines a set of valid tuples according to the constraints on each of its constituent columns
    • Method Detail

      • withColumnDomains

        public static <T> TupleDomain<T> withColumnDomains​(java.util.Map<T,​Domain> domains)
      • extractFixedValues

        public static <T> java.util.Optional<java.util.Map<T,​NullableValue>> extractFixedValues​(TupleDomain<T> tupleDomain)
        Extract all column constraints that require exactly one value or only null in their respective Domains. Returns an empty Optional if the Domain is none.
      • extractDiscreteValues

        public static <T> java.util.Optional<java.util.Map<T,​java.util.List<NullableValue>>> extractDiscreteValues​(TupleDomain<T> tupleDomain)
        Extract all column constraints that define a non-empty set of discrete values allowed for the columns in their respective Domains. Returns an empty Optional if the Domain is none.
      • fromFixedValues

        public static <T> TupleDomain<T> fromFixedValues​(java.util.Map<T,​NullableValue> fixedValues)
        Convert a map of columns to values into the TupleDomain which requires those columns to be fixed to those values. Null is allowed as a fixed value.
      • isAll

        public boolean isAll()
        Returns true if any tuples would satisfy this TupleDomain
      • isNone

        public boolean isNone()
        Returns true if no tuple could ever satisfy this TupleDomain
      • getDomains

        public java.util.Optional<java.util.Map<T,​Domain>> getDomains()
        Gets the TupleDomain as a map of each column to its respective Domain. - Will return an Optional.empty() if this is a 'none' TupleDomain. - Unmentioned columns have an implicit value of Domain.all() - The column Domains can be thought of as AND'ed to together to form the whole predicate
      • intersect

        public TupleDomain<T> intersect​(TupleDomain<T> other)
        Returns the strict intersection of the TupleDomains. The resulting TupleDomain represents the set of tuples that would be valid in both TupleDomains.
      • columnWiseUnion

        public static <T> TupleDomain<T> columnWiseUnion​(java.util.List<TupleDomain<T>> tupleDomains)
        Returns a TupleDomain in which corresponding column Domains are unioned together.

        Note that this is NOT equivalent to a strict union as the final result may allow tuples that do not exist in either TupleDomain. Example 1:

        • TupleDomain X: a => 1, b => 2
        • TupleDomain Y: a => 2, b => 3
        • Column-wise unioned TupleDomain: a => 1 OR 2, b => 2 OR 3

        In the above resulting TupleDomain, tuple (a => 1, b => 3) would be considered valid but would not be valid for either TupleDomain X or TupleDomain Y. Example 2:

        Let a be of type DOUBLE

        • TupleDomain X: (a < 5)
        • TupleDomain Y: (a > 0)
        • Column-wise unioned TupleDomain: (a IS NOT NULL)

        In the above resulting TupleDomain, tuple (a => NaN) would be considered valid but would not be valid for either TupleDomain X or TupleDomain Y. However, this result is guaranteed to be a superset of the strict union.
      • overlaps

        public boolean overlaps​(TupleDomain<T> other)
        Returns true only if there exists a strict intersection between the TupleDomains. i.e. there exists some potential tuple that would be allowable in both TupleDomains.
      • contains

        public boolean contains​(TupleDomain<T> other)
        Returns true only if the this TupleDomain contains all possible tuples that would be allowable by the other TupleDomain.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • filter

        public TupleDomain<T> filter​(java.util.function.BiPredicate<T,​Domain> predicate)
      • transform

        public <U> TupleDomain<U> transform​(java.util.function.Function<T,​U> function)
      • simplify

        public TupleDomain<T> simplify​(int threshold)
      • transformDomains

        public TupleDomain<T> transformDomains​(java.util.function.BiFunction<T,​Domain,​Domain> transformation)