static Expression trimNonTopLevelAliases(Expression expr) {
        if (expr instanceof Alias) {
            Alias alias = (Alias) expr;
            Expression newChild = trimAliases(alias.child);
            if (!newChild.fastEquals(alias.child)) {
                return new Alias(trimAliases(alias.child), alias.name(), alias.exprId);
            } else {
                return expr;
            }
        }
        return trimAliases(expr);
    }
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