提交 448567f1 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Extract Parser.parseSimpleSortType() for ASC and DESC only

上级 cd84f8f1
......@@ -1209,12 +1209,7 @@ public class Parser {
}
private int parseSortType() {
int sortType = 0;
if (readIf("ASC")) {
// ignore
} else if (readIf("DESC")) {
sortType = SortOrder.DESCENDING;
}
int sortType = parseSimpleSortType();
if (readIf("NULLS")) {
if (readIf("FIRST")) {
sortType |= SortOrder.NULLS_FIRST;
......@@ -1226,6 +1221,13 @@ public class Parser {
return sortType;
}
private int parseSimpleSortType() {
if (!readIf("ASC") && readIf("DESC")) {
return SortOrder.DESCENDING;
}
return SortOrder.ASCENDING;
}
private String[] parseColumnList() {
ArrayList<String> columns = Utils.newSmallArrayList();
do {
......@@ -2983,7 +2985,7 @@ public class Parser {
ArrayList<SelectOrderBy> orderList = new ArrayList<>(1);
SelectOrderBy order = new SelectOrderBy();
order.expression = expr;
order.sortType = parseSortType();
order.sortType = parseSimpleSortType();
orderList.add(order);
r.setOrderByList(orderList);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论