Class SubQueryRemoveRule

    • Constructor Detail

      • SubQueryRemoveRule

        public SubQueryRemoveRule​(RelOptRuleOperand operand,
                                  RelBuilderFactory relBuilderFactory,
                                  java.lang.String description)
        Creates a SubQueryRemoveRule.
        Parameters:
        operand - root operand, must not be null
        description - Description, or null to guess description
        relBuilderFactory - Builder for relational expressions
    • Method Detail

      • rewriteScalarQuery

        private RexNode rewriteScalarQuery​(RexSubQuery e,
                                           java.util.Set<CorrelationId> variablesSet,
                                           RelBuilder builder,
                                           int inputCount,
                                           int offset)
        Rewrites a scalar sub-query into an Aggregate.
        Parameters:
        e - IN sub-query to rewrite
        variablesSet - A set of variables used by a relational expression of the specified RexSubQuery
        builder - Builder
        offset - Offset to shift RexInputRef
        Returns:
        Expression that may be used to replace the RexSubQuery
      • rewriteSome

        private RexNode rewriteSome​(RexSubQuery e,
                                    java.util.Set<CorrelationId> variablesSet,
                                    RelBuilder builder)
        Rewrites a SOME sub-query into a Join.
        Parameters:
        e - SOME sub-query to rewrite
        builder - Builder
        Returns:
        Expression that may be used to replace the RexSubQuery
      • rewriteExists

        private RexNode rewriteExists​(RexSubQuery e,
                                      java.util.Set<CorrelationId> variablesSet,
                                      RelOptUtil.Logic logic,
                                      RelBuilder builder)
        Rewrites an EXISTS RexSubQuery into a Join.
        Parameters:
        e - EXISTS sub-query to rewrite
        variablesSet - A set of variables used by a relational expression of the specified RexSubQuery
        logic - Logic for evaluating
        builder - Builder
        Returns:
        Expression that may be used to replace the RexSubQuery
      • rewriteIn

        private RexNode rewriteIn​(RexSubQuery e,
                                  java.util.Set<CorrelationId> variablesSet,
                                  RelOptUtil.Logic logic,
                                  RelBuilder builder,
                                  int offset)
        Rewrites an IN RexSubQuery into a Join.
        Parameters:
        e - IN sub-query to rewrite
        variablesSet - A set of variables used by a relational expression of the specified RexSubQuery
        logic - Logic for evaluating
        builder - Builder
        offset - Offset to shift RexInputRef
        Returns:
        Expression that may be used to replace the RexSubQuery
      • field

        private RexInputRef field​(RelBuilder builder,
                                  int inputCount,
                                  int offset)
        Returns a reference to a particular field, by offset, across several inputs on a RelBuilder's stack.
      • fields

        private static java.util.List<RexNode> fields​(RelBuilder builder,
                                                      int fieldCount)
        Returns a list of expressions that project the first fieldCount fields of the top input on a RelBuilder's stack.