tkalkirill commented on code in PR #1407:
URL: https://github.com/apache/ignite-3/pull/1407#discussion_r1044179956
##########
modules/storage-api/src/testFixtures/java/org/apache/ignite/internal/storage/index/AbstractSortedIndexStorageTest.java:
##########
@@ -579,6 +585,401 @@ void testNullValues(ColumnDefinition columnDefinition)
throws Exception {
}
}
+ /**
+ * Checks simple scenarios for a scanning cursor.
+ */
+ @Test
+ void testScanSimple() {
+ SortedIndexDefinition indexDefinition =
SchemaBuilders.sortedIndex("TEST_IDX")
+
.addIndexColumn(ColumnType.INT32.typeSpec().name()).asc().done()
+ .build();
+
+ SortedIndexStorage indexStorage = createIndexStorage(indexDefinition);
+
+ BinaryTupleRowSerializer serializer = new
BinaryTupleRowSerializer(indexStorage.indexDescriptor());
+
+ for (int i = 0; i < 5; i++) {
+ put(indexStorage, serializer.serializeRow(new Object[]{i}, new
RowId(TEST_PARTITION)));
+ }
+
+ // Checking without borders.
+ assertThat(
+ scan(indexStorage, null, null, 0).stream().map(objects ->
objects[0]).collect(toList()),
+ contains(0, 1, 2, 3, 4)
+ );
+
+ // Let's check without borders.
+ assertThat(
+ indexStorage.scan(
+ serializer.serializeRowPrefix(0),
+ serializer.serializeRowPrefix(4),
+ (GREATER_OR_EQUAL | LESS_OR_EQUAL)
+ ).stream()
+ .map(indexRow ->
serializer.deserializeColumns(indexRow)[0])
+ .collect(toList()),
+ contains(0, 1, 2, 3, 4)
+ );
+
+ assertThat(
+ indexStorage.scan(
+ serializer.serializeRowPrefix(0),
+ serializer.serializeRowPrefix(4),
+ (GREATER_OR_EQUAL | LESS)
+ ).stream()
+ .map(indexRow ->
serializer.deserializeColumns(indexRow)[0])
+ .collect(toList()),
+ contains(0, 1, 2, 3)
Review Comment:
In `org.hamcrest.Matchers#contains(E...)`, it is checked for equality by the
number of elements, I looked at the documentation and tried it with my hands.
--
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]