Package io.trino.spi.predicate
Class TupleDomain<T>
java.lang.Object
io.trino.spi.predicate.TupleDomain<T>
Defines a set of valid tuples according to the constraints on each of its constituent columns
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TupleDomain<T>all()static <T> TupleDomain<T>columnWiseUnion(TupleDomain<T> first, TupleDomain<T> second, TupleDomain<T>... rest) static <T> TupleDomain<T>columnWiseUnion(List<TupleDomain<T>> tupleDomains) Returns a TupleDomain in which corresponding column Domains are unioned together.booleancontains(TupleDomain<T> other) Returns true only if the this TupleDomain contains all possible tuples that would be allowable by the other TupleDomain.booleanstatic <T> Optional<Map<T,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.static <T> Optional<Map<T,NullableValue>> extractFixedValues(TupleDomain<T> tupleDomain) Extract all column constraints that require exactly one value or only null in their respective Domains.filter(BiPredicate<T, Domain> predicate) static <T> TupleDomain<T>fromColumnDomains(Optional<List<TupleDomain.ColumnDomain<T>>> columnDomains) Deprecated.static <T> TupleDomain<T>fromFixedValues(Map<T, NullableValue> fixedValues) Convert a map of columns to values into the TupleDomain which requires those columns to be fixed to those values.Deprecated.Gets the TupleDomain as a map of each column to its respective Domain.longgetRetainedSizeInBytes(ToLongFunction<T> keySize) inthashCode()<U extends T>
TupleDomain<T>intersect(TupleDomain<U> other) Returns the strict intersection of the TupleDomains.static <T> TupleDomain<T>intersect(List<? extends TupleDomain<? extends T>> domains) booleanisAll()Returns true if any tuples would satisfy this TupleDomainbooleanisNone()Returns true if no tuple could ever satisfy this TupleDomainstatic <T> Optional<TupleDomain<T>>maximal(List<TupleDomain<T>> domains) Returns the tuple domain that contains all other tuple domains, orOptional.empty()if they are not supersets of each other.static <T> TupleDomain<T>none()booleanoverlaps(TupleDomain<T> other) Returns true only if there exists a strict intersection between the TupleDomains.simplify()simplify(int threshold) toString()toString(ConnectorSession session) transformDomains(BiFunction<T, Domain, Domain> transformation) <U> TupleDomain<U>transformKeys(Function<T, U> function) static <T> TupleDomain<T>withColumnDomains(Map<T, Domain> domains)
-
Method Details
-
withColumnDomains
-
none
-
all
-
extractFixedValues
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> Optional<Map<T,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
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. -
fromColumnDomains
@Deprecated public static <T> TupleDomain<T> fromColumnDomains(Optional<List<TupleDomain.ColumnDomain<T>>> columnDomains) Deprecated. -
getColumnDomains
Deprecated. -
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
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 -
getDomain
-
intersect
Returns the strict intersection of the TupleDomains. The resulting TupleDomain represents the set of tuples that would be valid in both TupleDomains. -
intersect
-
columnWiseUnion
@SafeVarargs public static <T> TupleDomain<T> columnWiseUnion(TupleDomain<T> first, TupleDomain<T> second, TupleDomain<T>... rest) -
maximal
Returns the tuple domain that contains all other tuple domains, orOptional.empty()if they are not supersets of each other. -
columnWiseUnion
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)
-
overlaps
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
Returns true only if the this TupleDomain contains all possible tuples that would be allowable by the other TupleDomain. -
equals
-
hashCode
public int hashCode() -
toString
-
toString
-
filter
-
transformKeys
-
simplify
-
simplify
-
transformDomains
-
asPredicate
-
getRetainedSizeInBytes
-