Class GroupByNode.ExpressionSorter

  • All Implemented Interfaces:
    java.util.Comparator<SubstituteExpressionVisitor>
    Enclosing class:
    GroupByNode

    private static class GroupByNode.ExpressionSorter
    extends java.lang.Object
    implements java.util.Comparator<SubstituteExpressionVisitor>
    Comparator class for GROUP BY expression substitution. This class enables the sorting of a collection of SubstituteExpressionVisitor instances. We sort the visitors during the tree manipulation processing in order to process expressions of higher complexity prior to expressions of lower complexity. Processing the expressions in this order ensures that we choose the best match for an expression, and thus avoids problems where we substitute a sub-expression instead of the full expression. For example, if the statement is: ... GROUP BY a+b, a, a*(a+b), a+b+c we'll process those expressions in the order: a*(a+b), a+b+c, a+b, then a.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private ExpressionSorter()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(SubstituteExpressionVisitor o1, SubstituteExpressionVisitor o2)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong