Class ProjectToWindowRule.WindowedAggRelSplitter

  • Enclosing class:
    ProjectToWindowRule

    static class ProjectToWindowRule.WindowedAggRelSplitter
    extends CalcRelSplitter
    Splitter that distinguishes between windowed aggregation expressions (calls to RexOver) and ordinary expressions.
    • Constructor Detail

      • WindowedAggRelSplitter

        WindowedAggRelSplitter​(Calc calc,
                               RelBuilder relBuilder)
    • Method Detail

      • getCohorts

        protected java.util.List<java.util.Set<java.lang.Integer>> getCohorts()
        Description copied from class: CalcRelSplitter
        Returns a list of sets of expressions that should be on the same level.

        For example, if this method returns { {3, 5}, {4, 7} }, it means that expressions 3 and 5, should be on the same level, and expressions 4 and 7 should be on the same level. The two cohorts do not need to be on the same level.

        The list is best effort. If it is not possible to arrange that the expressions in a cohort are on the same level, the CalcRelSplitter.execute() method will still succeed.

        The default implementation of this method returns the empty list; expressions will be put on the most suitable level. This is generally the lowest possible level, except for literals, which are placed at the level where they are used.

        Overrides:
        getCohorts in class CalcRelSplitter
        Returns:
        List of cohorts, that is sets of expressions, that the splitting algorithm should attempt to place on the same level
      • isDependent

        private boolean isDependent​(DirectedGraph<java.lang.Integer,​DefaultEdge> graph,
                                    java.util.List<java.lang.Integer> rank,
                                    int ordinal1,
                                    int ordinal2)
      • getRank

        private java.util.List<java.lang.Integer> getRank​(DirectedGraph<java.lang.Integer,​DefaultEdge> graph)