You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2022/12/12 17:33:28 UTC

[GitHub] [ignite-3] tkalkirill commented on a diff in pull request #1424: IGNITE-18243 Implement a peek method for the sorted index cursor

tkalkirill commented on code in PR #1424:
URL: https://github.com/apache/ignite-3/pull/1424#discussion_r1046146547


##########
modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/index/impl/TestSortedIndexStorage.java:
##########
@@ -237,6 +238,38 @@ public IndexRow next() {
             return new IndexRowImpl(new BinaryTuple(descriptor.binaryTupleSchema(), indexMapEntry.getKey()), rowId);
         }
 
+        @Override
+        public @Nullable IndexRow peek() {
+            if (hasNext != null && !hasNext) {

Review Comment:
   Yes, they are similar, `advanceIfNeeded` can change the state of both `TestSortedIndexStorage.ScanCursor#indexMapEntry` and `TestSortedIndexStorage.ScanCursor#row`, which makes it a little difficult to highlight the common parts.



##########
modules/storage-page-memory/src/main/java/org/apache/ignite/internal/storage/pagememory/index/sorted/PageMemorySortedIndexStorage.java:
##########
@@ -337,6 +338,31 @@ public IndexRow next() {
             }
         }
 
+        @Override
+        public @Nullable IndexRow peek() {
+            if (hasNext != null && !hasNext) {
+                return null;
+            }
+
+            try {
+                SortedIndexRow nextTreeRow;
+
+                if (treeRow == null) {
+                    nextTreeRow = lower == null ? sortedIndexTree.findFirst() : sortedIndexTree.findNext(lower, true);

Review Comment:
   Same here



-- 
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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org