improved SchemaStatVisitor, support aggregateFunctions

This commit is contained in:
wenshao
2016-08-16 17:14:57 +08:00
parent 831122921b
commit f220b0887d
@@ -136,6 +136,7 @@ public class SchemaStatVisitor extends SQLASTVisitorAdapter {
protected final Set<Relationship> relationships = new LinkedHashSet<Relationship>();
protected final List<Column> orderByColumns = new ArrayList<Column>();
protected final Set<Column> groupByColumns = new LinkedHashSet<Column>();
protected final List<SQLAggregateExpr> aggregateFunctions = new ArrayList<SQLAggregateExpr>();
protected final Map<String, SQLObject> subQueryMap = new LinkedHashMap<String, SQLObject>();
@@ -400,6 +401,10 @@ public class SchemaStatVisitor extends SQLASTVisitorAdapter {
public List<Condition> getConditions() {
return conditions;
}
public List<SQLAggregateExpr> getAggregateFunctions() {
return aggregateFunctions;
}
public boolean visit(SQLBinaryOpExpr x) {
x.getLeft().setParent(x);
@@ -1176,6 +1181,8 @@ public class SchemaStatVisitor extends SQLASTVisitorAdapter {
}
public boolean visit(SQLAggregateExpr x) {
this.aggregateFunctions.add(x);
accept(x.getArguments());
accept(x.getWithinGroup());
accept(x.getOver());