Package io.trino.sql.planner
Class EqualityInference
java.lang.Object
io.trino.sql.planner.EqualityInference
Makes equality based inferences to rewrite Expressions and generate equality sets in terms of specified symbol scopes
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptiongenerateEqualitiesPartitionedBy(Set<Symbol> scope) Dumps the inference equalities as equality expressions that are partitioned by the symbolScope.static booleanisInferenceCandidate(Metadata metadata, Expression expression) Determines whether an Expression may be successfully applied to the equality inferencestatic EqualityInferencenewInstance(Metadata metadata, Expression... expressions) static EqualityInferencenewInstance(Metadata metadata, Collection<Expression> expressions) static Stream<Expression>nonInferrableConjuncts(Metadata metadata, Expression expression) Provides a convenience Stream of Expression conjuncts which have not been added to the inferencerewrite(Expression expression, Set<Symbol> scope) Attempts to rewrite an Expression in terms of the symbols allowed by the symbol scope given the known equalities.
-
Method Details
-
rewrite
Attempts to rewrite an Expression in terms of the symbols allowed by the symbol scope given the known equalities. Returns null if unsuccessful. -
generateEqualitiesPartitionedBy
Dumps the inference equalities as equality expressions that are partitioned by the symbolScope. All stored equalities are returned in a compact set and will be classified into three groups as determined by the symbol scope:- equalities that fit entirely within the symbol scope
- equalities that fit entirely outside of the symbol scope
- equalities that straddle the symbol scope
Example: Stored Equalities: a = b = c d = e = f = g Symbol Scope: a, b, d, e Output EqualityPartition: Scope Equalities: a = b d = e Complement Scope Equalities f = g Scope Straddling Equalities a = c d = f -
isInferenceCandidate
Determines whether an Expression may be successfully applied to the equality inference -
newInstance
-
newInstance
-
nonInferrableConjuncts
Provides a convenience Stream of Expression conjuncts which have not been added to the inference
-