tkalkirill commented on code in PR #1407:
URL: https://github.com/apache/ignite-3/pull/1407#discussion_r1044177646
##########
modules/page-memory/src/main/java/org/apache/ignite/internal/pagememory/tree/BplusTree.java:
##########
@@ -6222,6 +6250,72 @@ public void close() {
}
}
+ /**
+ * Class for getting the next row.
+ */
+ private final class GetNext extends Get {
+ @Nullable
+ private T nextRow;
+
+ private GetNext(L row, boolean includeRow) {
+ super(row, false);
+
+ shift = includeRow ? -1 : 1;
+ }
+
+ @Override
+ boolean found(BplusIo<L> io, long pageAddr, int idx, int lvl) {
+ // Must never be called because we always have a shift.
+ throw new IllegalStateException();
+ }
+
+ @Override
+ boolean notFound(BplusIo<L> io, long pageAddr, int idx, int lvl)
throws IgniteInternalCheckedException {
+ if (lvl != 0) {
+ return false;
+ }
+
+ int cnt = io.getCount(pageAddr);
+
+ if (cnt == 0) {
+ // Empty tree.
+ assert io.getForward(pageAddr, partId) == 0L;
+ } else {
+ assert io.isLeaf() : io;
+ assert cnt > 0 : cnt;
+ assert idx >= 0 || idx == -1 : idx;
+ assert cnt >= idx : "cnt=" + cnt + ", idx=" + idx;
+
+ checkDestroyed();
+
+ if (idx == -1) {
+ idx = findNextRowIdx(pageAddr, io, cnt);
+ }
+
+ if (cnt - idx > 0) {
+ nextRow = getRow(io, pageAddr, idx);
+ }
+ }
+
+ return true;
+ }
+
+ int findNextRowIdx(long pageAddr, BplusIo<L> io, int cnt) throws
IgniteInternalCheckedException {
+ // Compare with the first row on the page.
+ int cmp = compare(0, io, pageAddr, 0, row);
Review Comment:
We will never get into this code because the `idx` is always >=0, I deleted
this code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]