Class 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.
    • Method Detail

      • getInnerJoinSelectors

        public java.util.ArrayList<SourceImpl> getInnerJoinSelectors()
        Description copied from class: SourceImpl
        Get all sources that are joined via inner join. (These can be swapped.)
        Specified by:
        getInnerJoinSelectors in class SourceImpl
        Returns:
        the list of selectors (sorted from left to right)
      • getInnerJoinConditions

        public java.util.List<JoinConditionImpl> getInnerJoinConditions()
        Description copied from class: SourceImpl
        Get the list of inner join conditions. (These match the inner join selectors.)
        Overrides:
        getInnerJoinConditions in class SourceImpl
        Returns:
        the list of join conditions
      • getPlan

        public java.lang.String getPlan​(NodeState rootState)
        Description copied from class: SourceImpl
        Get the query plan.
        Specified by:
        getPlan in class SourceImpl
        Parameters:
        rootState - the root
        Returns:
        the query plan
      • getIndexCostInfo

        public java.lang.String getIndexCostInfo​(NodeState rootState)
        Description copied from class: SourceImpl
        Get the index cost as a JSON string.
        Specified by:
        getIndexCostInfo in class SourceImpl
        Parameters:
        rootState - the root
        Returns:
        the cost
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • prepare

        public void prepare​(ExecutionPlan p)
        Description copied from class: SourceImpl
        Re-apply a previously prepared plan. This will also 're-wire' the selectors with the join constraints
        Specified by:
        prepare in class SourceImpl
        Parameters:
        p - the plan to use
      • prepare

        public ExecutionPlan prepare()
        Description copied from class: SourceImpl
        Prepare executing the query (recursively). This will 'wire' the selectors with the join constraints, and decide which index to use.
        Specified by:
        prepare in class SourceImpl
        Returns:
        the execution plan
      • getSelector

        public SelectorImpl getSelector​(java.lang.String selectorName)
        Description copied from class: SourceImpl
        Get the selector with the given name, or null if not found.
        Specified by:
        getSelector in class SourceImpl
        Parameters:
        selectorName - the selector name
        Returns:
        the selector, or null
      • execute

        public void execute​(NodeState rootState)
        Description copied from class: SourceImpl
        Execute the query. The current node is set to before the first row.
        Specified by:
        execute in class SourceImpl
        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:
        createFilter in class SourceImpl
        Parameters:
        preparing - whether this this the prepare phase
        Returns:
        a new filter
      • setQueryConstraint

        public void setQueryConstraint​(ConstraintImpl queryConstraint)
        Description copied from class: SourceImpl
        Set the complete constraint of the query (the WHERE ... condition).
        Specified by:
        setQueryConstraint in class SourceImpl
        Parameters:
        queryConstraint - the constraint
      • setOuterJoin

        public void setOuterJoin​(boolean outerJoinLeftHandSide,
                                 boolean outerJoinRightHandSide)
        Description copied from class: SourceImpl
        Set whether this source is the left hand side or right hand side of a left outer join.
        Specified by:
        setOuterJoin in class SourceImpl
        Parameters:
        outerJoinLeftHandSide - true if yes
        outerJoinRightHandSide - true if yes
      • addJoinCondition

        public void addJoinCondition​(JoinConditionImpl joinCondition,
                                     boolean forThisSelector)
        Description copied from class: SourceImpl
        Add the join condition (the ON ... condition).
        Specified by:
        addJoinCondition in class SourceImpl
        Parameters:
        joinCondition - the join condition
        forThisSelector - if set, the join condition can only be evaluated when all previous selectors are executed.
      • next

        public boolean next()
        Description copied from class: SourceImpl
        Go to the next node for the given source. This will also filter the result for the right node type if required.
        Specified by:
        next in class SourceImpl
        Returns:
        true if there is a next row
      • isOuterJoinRightHandSide

        public boolean isOuterJoinRightHandSide()
        Description copied from class: SourceImpl
        Whether any selector is the outer-join right hand side.
        Specified by:
        isOuterJoinRightHandSide in class SourceImpl
        Returns:
        true if there is any
      • getSize

        public long getSize​(NodeState rootState,
                            Result.SizePrecision precision,
                            long max)
        Description copied from class: SourceImpl
        Get the size if known.
        Specified by:
        getSize in class SourceImpl
        Parameters:
        rootState - the root node state (to initialize the cursor, if needed)
        precision - the required precision
        max - 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 AstElement returns same reference to this.
      • protect

        protected java.lang.String protect​(java.lang.Object expression)
      • quote

        protected java.lang.String quote​(java.lang.String pathOrName)
      • quoteJson

        protected java.lang.String quoteJson​(java.lang.String string)
      • setQuery

        public void setQuery​(QueryImpl query)
      • normalizePropertyName

        protected java.lang.String normalizePropertyName​(java.lang.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 java.lang.String normalizePath​(java.lang.String path)
        Validate and normalize the path.
        Parameters:
        path - the path to validate
        Returns:
        the validated and normalized path
      • getLocalPath

        protected java.lang.String getLocalPath​(java.lang.String path)
        Calculate the session local path (the path excluding the workspace name) if possible.
        Parameters:
        path - the absolute path
        Returns:
        the session local path, or null if not within this workspace