Package io.prestosql.sql.planner
Class EqualityInference
- java.lang.Object
-
- io.prestosql.sql.planner.EqualityInference
-
public class EqualityInference extends Object
Makes equality based inferences to rewrite Expressions and generate equality sets in terms of specified symbol scopes
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
EqualityInference.EqualityPartition
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description EqualityInference.EqualityPartition
generateEqualitiesPartitionedBy(Set<Symbol> scope)
Dumps the inference equalities as equality expressions that are partitioned by the symbolScope.static boolean
isInferenceCandidate(Metadata metadata, Expression expression)
Determines whether an Expression may be successfully applied to the equality inferencestatic EqualityInference
newInstance(Metadata metadata, Expression... expressions)
static EqualityInference
newInstance(Metadata metadata, Collection<Expression> expressions)
static List<Expression>
nonInferrableConjuncts(Metadata metadata, Expression expression)
Provides a convenience Iterable of Expression conjuncts which have not been added to the inferenceExpression
rewrite(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 Detail
-
rewrite
public Expression rewrite(Expression expression, Set<Symbol> scope)
Attempts to rewrite an Expression in terms of the symbols allowed by the symbol scope given the known equalities. Returns null if unsuccessful.
-
generateEqualitiesPartitionedBy
public EqualityInference.EqualityPartition generateEqualitiesPartitionedBy(Set<Symbol> scope)
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
public static boolean isInferenceCandidate(Metadata metadata, Expression expression)
Determines whether an Expression may be successfully applied to the equality inference
-
newInstance
public static EqualityInference newInstance(Metadata metadata, Expression... expressions)
-
newInstance
public static EqualityInference newInstance(Metadata metadata, Collection<Expression> expressions)
-
nonInferrableConjuncts
public static List<Expression> nonInferrableConjuncts(Metadata metadata, Expression expression)
Provides a convenience Iterable of Expression conjuncts which have not been added to the inference
-
-