Package org.apache.druid.segment.join
Class JoinConditionAnalysis
java.lang.Object
org.apache.druid.segment.join.JoinConditionAnalysis
- All Implemented Interfaces:
Cacheable
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
Modifier and TypeMethodDescriptionbooleanReturns whether this condition can be satisfied using a hashtable made from the right-hand side.booleanstatic JoinConditionAnalysisforExpression(String condition, String rightPrefix, ExprMacroTable macroTable) Analyze a join condition.static JoinConditionAnalysisforExpression(String condition, Expr conditionExpr, String rightPrefix) Analyze a join condition from a pre-parsed expression.byte[]Get a byte array used as a cache key.Return a list of equi-conditions (see class-level javadoc).Return a list of non-equi-conditions (see class-level javadoc).Return the condition expression.Returns the set of column names required by this join condition.Returns the distinct column keys from the RHS required to evaluate the equi conditions.inthashCode()booleanReturn whether this condition is a constant that is always false.booleanReturn whether this condition is a constant that is always true.toString()
-
Method Details
-
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
Return the condition expression. -
getEquiConditions
Return a list of equi-conditions (see class-level javadoc). -
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
Returns the distinct column keys from the RHS required to evaluate the equi conditions. -
getRequiredColumns
Returns the set of column names required by this join condition. Columns from the right-hand side are returned with their prefixes included. -
equals
-
hashCode
public int hashCode() -
toString
-
getCacheKey
public byte[] getCacheKey()Description copied from interface:CacheableGet a byte array used as a cache key.- Specified by:
getCacheKeyin interfaceCacheable- Returns:
- bytes to be used as cache key - or null if this object should not be cached.
-