@Override
        public LogicalPlan apply(LogicalPlan oldPlan) {
            return oldPlan.resolveOperators(plan -> {
                LogicalPlan newPlan = null;
                if ((plan instanceof Sort) && (newPlan = applySort((Sort) plan)) != null) {
                    return newPlan;
                }
                if ((plan instanceof Aggregate) && (newPlan = applyAggregat((Aggregate) plan)) != null) {
                    return newPlan;
                }
                return plan;
            });
        }
This rule finds aggregate expressions that are not in an aggregate operator.  For example,
those in a HAVING clause or ORDER BY clause.  These expressions are pushed down to the
underlying aggregate operator and then projected away after the original operator.
indexr-query-opt/src/main/java/io/indexr/query/Analyzer.java