Class JoinImpl
- java.lang.Object
-
- org.apache.jackrabbit.oak.query.ast.SourceImpl
-
- org.apache.jackrabbit.oak.query.ast.JoinImpl
-
public class JoinImpl extends SourceImpl
A join. This object contains the left hand side source, the right hand side source, the join type, and the join condition.
-
-
Constructor Summary
Constructors Constructor Description JoinImpl(SourceImpl left, SourceImpl right, JoinType joinType, JoinConditionImpl joinCondition)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddJoinCondition(JoinConditionImpl joinCondition, boolean forThisSelector)Add the join condition (the ON ...protected PropertyValueconvertValueToType(PropertyValue v, PropertyValue targetType)org.apache.jackrabbit.oak.query.ast.AstElementcopyOf()FiltercreateFilter(boolean preparing)!Test purpose only! this creates a filter for the given queryvoidexecute(NodeState rootState)Execute the query.StringgetIndexCostInfo(NodeState rootState)Get the index cost as a JSON string.List<JoinConditionImpl>getInnerJoinConditions()Get the list of inner join conditions.ArrayList<SourceImpl>getInnerJoinSelectors()Get all sources that are joined via inner join.JoinConditionImplgetJoinCondition()SourceImplgetLeft()protected StringgetLocalPath(String path)Calculate the session local path (the path excluding the workspace name) if possible.StringgetPlan(NodeState rootState)Get the query plan.SourceImplgetRight()SelectorImplgetSelector(String selectorName)Get the selector with the given name, or null if not found.longgetSize(NodeState rootState, Result.SizePrecision precision, long max)Get the size if known.booleanisOuterJoinRightHandSide()Whether any selector is the outer-join right hand side.booleannext()Go to the next node for the given source.protected StringnormalizePath(String path)Validate and normalize the path.protected StringnormalizePropertyName(String propertyName)Normalize the property name (including namespace remapping).ExecutionPlanprepare()Prepare executing the query (recursively).voidprepare(ExecutionPlan p)Re-apply a previously prepared plan.protected Stringprotect(Object expression)protected static Stringquote(String pathOrName)protected static StringquoteJson(String string)voidsetOuterJoin(boolean outerJoinLeftHandSide, boolean outerJoinRightHandSide)Set whether this source is the left hand side or right hand side of a left outer join.voidsetQuery(QueryImpl query)voidsetQueryConstraint(ConstraintImpl queryConstraint)Set the complete constraint of the query (the WHERE ...StringtoString()voidunprepare()Undo a prepare.-
Methods inherited from class org.apache.jackrabbit.oak.query.ast.SourceImpl
getExistingSelector
-
-
-
-
Field Detail
-
query
protected QueryImpl query
-
-
Constructor Detail
-
JoinImpl
public JoinImpl(SourceImpl left, SourceImpl right, JoinType joinType, JoinConditionImpl joinCondition)
-
-
Method Detail
-
getInnerJoinSelectors
public ArrayList<SourceImpl> getInnerJoinSelectors()
Description copied from class:SourceImplGet all sources that are joined via inner join. (These can be swapped.)- Specified by:
getInnerJoinSelectorsin classSourceImpl- Returns:
- the list of selectors (sorted from left to right)
-
getInnerJoinConditions
public List<JoinConditionImpl> getInnerJoinConditions()
Description copied from class:SourceImplGet the list of inner join conditions. (These match the inner join selectors.)- Overrides:
getInnerJoinConditionsin classSourceImpl- Returns:
- the list of join conditions
-
getJoinCondition
public JoinConditionImpl getJoinCondition()
-
getLeft
public SourceImpl getLeft()
-
getRight
public SourceImpl getRight()
-
getPlan
public String getPlan(NodeState rootState)
Description copied from class:SourceImplGet the query plan.- Specified by:
getPlanin classSourceImpl- Parameters:
rootState- the root- Returns:
- the query plan
-
getIndexCostInfo
public String getIndexCostInfo(NodeState rootState)
Description copied from class:SourceImplGet the index cost as a JSON string.- Specified by:
getIndexCostInfoin classSourceImpl- Parameters:
rootState- the root- Returns:
- the cost
-
unprepare
public void unprepare()
Description copied from class:SourceImplUndo a prepare.- Specified by:
unpreparein classSourceImpl
-
prepare
public void prepare(ExecutionPlan p)
Description copied from class:SourceImplRe-apply a previously prepared plan. This will also 're-wire' the selectors with the join constraints- Specified by:
preparein classSourceImpl- Parameters:
p- the plan to use
-
prepare
public ExecutionPlan prepare()
Description copied from class:SourceImplPrepare executing the query (recursively). This will 'wire' the selectors with the join constraints, and decide which index to use.- Specified by:
preparein classSourceImpl- Returns:
- the execution plan
-
getSelector
public SelectorImpl getSelector(String selectorName)
Description copied from class:SourceImplGet the selector with the given name, or null if not found.- Specified by:
getSelectorin classSourceImpl- Parameters:
selectorName- the selector name- Returns:
- the selector, or null
-
execute
public void execute(NodeState rootState)
Description copied from class:SourceImplExecute the query. The current node is set to before the first row.- Specified by:
executein classSourceImpl- Parameters:
rootState- root state of the given revision
-
createFilter
public Filter createFilter(boolean preparing)
Description copied from class:SourceImpl!Test purpose only! this creates a filter for the given query- Specified by:
createFilterin classSourceImpl- Parameters:
preparing- whether this this the prepare phase- Returns:
- a new filter
-
setQueryConstraint
public void setQueryConstraint(ConstraintImpl queryConstraint)
Description copied from class:SourceImplSet the complete constraint of the query (the WHERE ... condition).- Specified by:
setQueryConstraintin classSourceImpl- Parameters:
queryConstraint- the constraint
-
setOuterJoin
public void setOuterJoin(boolean outerJoinLeftHandSide, boolean outerJoinRightHandSide)Description copied from class:SourceImplSet whether this source is the left hand side or right hand side of a left outer join.- Specified by:
setOuterJoinin classSourceImpl- Parameters:
outerJoinLeftHandSide- true if yesouterJoinRightHandSide- true if yes
-
addJoinCondition
public void addJoinCondition(JoinConditionImpl joinCondition, boolean forThisSelector)
Description copied from class:SourceImplAdd the join condition (the ON ... condition).- Specified by:
addJoinConditionin classSourceImpl- Parameters:
joinCondition- the join conditionforThisSelector- if set, the join condition can only be evaluated when all previous selectors are executed.
-
next
public boolean next()
Description copied from class:SourceImplGo to the next node for the given source. This will also filter the result for the right node type if required.- Specified by:
nextin classSourceImpl- Returns:
- true if there is a next row
-
isOuterJoinRightHandSide
public boolean isOuterJoinRightHandSide()
Description copied from class:SourceImplWhether any selector is the outer-join right hand side.- Specified by:
isOuterJoinRightHandSidein classSourceImpl- Returns:
- true if there is any
-
getSize
public long getSize(NodeState rootState, Result.SizePrecision precision, long max)
Description copied from class:SourceImplGet the size if known.- Specified by:
getSizein classSourceImpl- Parameters:
rootState- the root node state (to initialize the cursor, if needed)precision- the required precisionmax- the maximum nodes read (for an exact size)- Returns:
- the size, or -1 if unknown
-
copyOf
public org.apache.jackrabbit.oak.query.ast.AstElement copyOf()
- Returns:
- a clone of self. Default implementation in
AstElementreturns same reference tothis.
-
setQuery
public void setQuery(QueryImpl query)
-
normalizePropertyName
protected String normalizePropertyName(String propertyName)
Normalize the property name (including namespace remapping). Asterisks are kept.- Parameters:
propertyName- the property name to normalize- Returns:
- the normalized (oak-) property name
-
normalizePath
protected String normalizePath(String path)
Validate and normalize the path.- Parameters:
path- the path to validate- Returns:
- the validated and normalized path
-
convertValueToType
protected PropertyValue convertValueToType(PropertyValue v, PropertyValue targetType)
-
-