提交 bdb244ac authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Extract Parser.readFilterCondition()

上级 c5bef216
......@@ -2631,6 +2631,17 @@ public class Parser {
}
}
private Expression readFilterCondition() {
if (readIf("FILTER")) {
read("(");
read("WHERE");
Expression filterCondition = readExpression();
read(")");
return filterCondition;
}
return null;
}
private Expression readAggregate(AggregateType aggregateType, String aggregateName) {
if (currentSelect == null) {
throw getSyntaxError();
......@@ -2695,12 +2706,8 @@ public class Parser {
distinct);
}
read(")");
if (r != null && readIf("FILTER")) {
read("(");
read("WHERE");
Expression condition = readExpression();
read(")");
r.setFilterCondition(condition);
if (r != null) {
r.setFilterCondition(readFilterCondition());
}
return r;
}
......@@ -2750,15 +2757,7 @@ public class Parser {
do {
params.add(readExpression());
} while (readIfMore(true));
Expression filterCondition;
if (readIf("FILTER")) {
read("(");
read("WHERE");
filterCondition = readExpression();
read(")");
} else {
filterCondition = null;
}
Expression filterCondition = readFilterCondition();
Expression[] list = params.toArray(new Expression[0]);
JavaAggregate agg = new JavaAggregate(aggregate, list, currentSelect, distinct, filterCondition);
currentSelect.setGroupQuery();
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论