Class SqlToRelConverter.AggConverter

  • All Implemented Interfaces:
    Enclosing class:

    protected class SqlToRelConverter.AggConverter
    extends java.lang.Object
    implements SqlVisitor<java.lang.Void>
    Converts expressions to aggregates.

    Consider the expression

    SELECT deptno, SUM(2 * sal) FROM emp GROUP BY deptno


    • groupExprs = {SqlIdentifier(deptno)}
    • convertedInputExprs = {RexInputRef(deptno), 2 * RefInputRef(sal)}
    • inputRefs = {RefInputRef(#0), RexInputRef(#1)}
    • aggCalls = {AggCall(SUM, {1})}
    • Field Detail

      • nameMap

        private final java.util.Map<java.lang.String,​java.lang.String> nameMap
      • groupExprs

        private final SqlNodeList groupExprs
        The group-by expressions, in SqlNode format.
      • auxiliaryGroupExprs

        private final java.util.Map<SqlNode,​Ord<AuxiliaryConverter>> auxiliaryGroupExprs
        The auxiliary group-by expressions.
      • convertedInputExprs

        private final java.util.List<Pair<RexNode,​java.lang.String>> convertedInputExprs
        Input expressions for the group columns and aggregates, in RexNode format. The first elements of the list correspond to the elements in groupExprs; the remaining elements are for aggregates. The right field of each pair is the name of the expression, where the expressions are simple mappings to input fields.
      • aggCalls

        private final java.util.List<AggregateCall> aggCalls
        Expressions to be evaluated as rows are being placed into the aggregate's hash table. This is when group functions such as TUMBLE cause rows to be expanded.
      • aggMapping

        private final java.util.Map<SqlNode,​RexNode> aggMapping
      • inOver

        private boolean inOver
        Are we directly inside a windowed aggregate?
    • Constructor Detail

      • AggConverter

        public AggConverter​(SqlToRelConverter.Blackboard bb,
                            SqlSelect select)
        Creates an AggConverter.

        The select parameter provides enough context to name aggregate calls which are top-level select list items.

        bb - Blackboard
        select - Query being translated; provides context to give