Package org.apache.druid.segment.join
Class JoinConditionAnalysis
- java.lang.Object
-
- org.apache.druid.segment.join.JoinConditionAnalysis
-
public class JoinConditionAnalysis extends Object
Represents analysis of a join condition. Each condition is decomposed into "equiConditions" and "nonEquiConditions". 1) The equiConditions are of the form ExpressionOfLeft = ColumnFromRight. The right-hand part cannot be an expression because we use this analysis to determine if we can perform the join using hashtables built off right-hand-side columns. 2) The nonEquiConditions are other conditions that should also be ANDed together All of these conditions are ANDed together to get the overall condition.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canHashJoin()
Returns whether this condition can be satisfied using a hashtable made from the right-hand side.boolean
equals(Object o)
static JoinConditionAnalysis
forExpression(String condition, String rightPrefix, ExprMacroTable macroTable)
Analyze a join condition.static JoinConditionAnalysis
forExpression(String condition, Expr conditionExpr, String rightPrefix)
Analyze a join condition from a pre-parsed expression.List<Equality>
getEquiConditions()
Return a list of equi-conditions (see class-level javadoc).List<Expr>
getNonEquiConditions()
Return a list of non-equi-conditions (see class-level javadoc).String
getOriginalExpression()
Return the condition expression.Set<String>
getRequiredColumns()
Returns the set of column names required by this join condition.Set<String>
getRightEquiConditionKeys()
Returns the distinct column keys from the RHS required to evaluate the equi conditions.int
hashCode()
boolean
isAlwaysFalse()
Return whether this condition is a constant that is always false.boolean
isAlwaysTrue()
Return whether this condition is a constant that is always true.String
toString()
-
-
-
Method Detail
-
forExpression
public static JoinConditionAnalysis forExpression(String condition, String rightPrefix, ExprMacroTable macroTable)
Analyze a join condition.- Parameters:
condition
- the condition expressionrightPrefix
- prefix for the right-hand side of the join; will be used to determine which identifiers in the condition come from the right-hand side and which come from the left-hand sidemacroTable
- macro table for parsing the condition expression
-
forExpression
public static JoinConditionAnalysis forExpression(String condition, Expr conditionExpr, String rightPrefix)
Analyze a join condition from a pre-parsed expression.- Parameters:
condition
- the condition expressionconditionExpr
- the parsed condition expression. Must match "condition".rightPrefix
- prefix for the right-hand side of the join; will be used to determine which identifiers in the condition come from the right-hand side and which come from the left-hand side
-
getOriginalExpression
public String getOriginalExpression()
Return the condition expression.
-
getEquiConditions
public List<Equality> getEquiConditions()
Return a list of equi-conditions (see class-level javadoc).
-
getNonEquiConditions
public List<Expr> getNonEquiConditions()
Return a list of non-equi-conditions (see class-level javadoc).
-
isAlwaysFalse
public boolean isAlwaysFalse()
Return whether this condition is a constant that is always false.
-
isAlwaysTrue
public boolean isAlwaysTrue()
Return whether this condition is a constant that is always true.
-
canHashJoin
public boolean canHashJoin()
Returns whether this condition can be satisfied using a hashtable made from the right-hand side.
-
getRightEquiConditionKeys
public Set<String> getRightEquiConditionKeys()
Returns the distinct column keys from the RHS required to evaluate the equi conditions.
-
getRequiredColumns
public Set<String> getRequiredColumns()
Returns the set of column names required by this join condition. Columns from the right-hand side are returned with their prefixes included.
-
-