提交 0d8696e1 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Extract WindowFrame.plainIterator()

上级 2bf25cb7
...@@ -179,7 +179,12 @@ public final class WindowFrame { ...@@ -179,7 +179,12 @@ public final class WindowFrame {
public static Iterator<Value[]> iterator(WindowFrame frame, Session session, ArrayList<Value[]> orderedRows, public static Iterator<Value[]> iterator(WindowFrame frame, Session session, ArrayList<Value[]> orderedRows,
SortOrder sortOrder, int currentRow, boolean reverse) { SortOrder sortOrder, int currentRow, boolean reverse) {
return frame != null ? frame.iterator(session, orderedRows, sortOrder, currentRow, reverse) return frame != null ? frame.iterator(session, orderedRows, sortOrder, currentRow, reverse)
: reverse ? new PlainReverseItr(orderedRows, 0, currentRow) : new PlainItr(orderedRows, 0, currentRow); : plainIterator(orderedRows, 0, currentRow, reverse);
}
private static Itr plainIterator(ArrayList<Value[]> orderedRows, int startIndex, int endIndex, boolean reverse) {
return reverse ? new PlainReverseItr(orderedRows, startIndex, endIndex)
: new PlainItr(orderedRows, startIndex, endIndex);
} }
private static int toGroupStart(ArrayList<Value[]> orderedRows, SortOrder sortOrder, int offset, int minOffset) { private static int toGroupStart(ArrayList<Value[]> orderedRows, SortOrder sortOrder, int offset, int minOffset) {
...@@ -317,11 +322,9 @@ public final class WindowFrame { ...@@ -317,11 +322,9 @@ public final class WindowFrame {
if (endIndex >= size) { if (endIndex >= size) {
endIndex = size - 1; endIndex = size - 1;
} }
if (exclusion != WindowFrameExclusion.EXCLUDE_NO_OTHERS) { return exclusion != WindowFrameExclusion.EXCLUDE_NO_OTHERS
return complexIterator(orderedRows, sortOrder, currentRow, startIndex, endIndex, reverse); ? complexIterator(orderedRows, sortOrder, currentRow, startIndex, endIndex, reverse)
} : plainIterator(orderedRows, startIndex, endIndex, reverse);
return reverse ? new PlainReverseItr(orderedRows, startIndex, endIndex)
: new PlainItr(orderedRows, startIndex, endIndex);
} }
private int getIndex(Session session, ArrayList<Value[]> orderedRows, SortOrder sortOrder, int currentRow, private int getIndex(Session session, ArrayList<Value[]> orderedRows, SortOrder sortOrder, int currentRow,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论