提交 7b199ff7 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Simplify GROUP_CONCAT / STRING_AGG logic, do not use null

上级 75827dfb
......@@ -3055,18 +3055,9 @@ public class Parser {
break;
case GROUP_CONCAT: {
boolean distinct = readDistinctAgg();
if (equalsToken("GROUP_CONCAT", aggregateName)) {
r = new Aggregate(AggregateType.GROUP_CONCAT, readExpression(), currentSelect, distinct);
if (readIf(ORDER)) {
read("BY");
r.setOrderByList(parseSimpleOrderList());
}
if (readIf("SEPARATOR")) {
r.setGroupConcatSeparator(readExpression());
}
} else if (equalsToken("STRING_AGG", aggregateName)) {
if (equalsToken("STRING_AGG", aggregateName)) {
// PostgreSQL compatibility: string_agg(expression, delimiter)
r = new Aggregate(AggregateType.GROUP_CONCAT, readExpression(), currentSelect, distinct);
read(COMMA);
r.setGroupConcatSeparator(readExpression());
if (readIf(ORDER)) {
......@@ -3074,7 +3065,13 @@ public class Parser {
r.setOrderByList(parseSimpleOrderList());
}
} else {
r = null;
if (readIf(ORDER)) {
read("BY");
r.setOrderByList(parseSimpleOrderList());
}
if (readIf("SEPARATOR")) {
r.setGroupConcatSeparator(readExpression());
}
}
break;
}
......@@ -3121,9 +3118,7 @@ public class Parser {
break;
}
read(CLOSE_PAREN);
if (r != null) {
readFilterAndOver(r);
}
return r;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论