Description
- getAll does not preserve element order.
- getAll does not return nulls for non-existent records.
This is specified in Javadoc in RecordView:
Records with all columns filled from the table. The order of collection elements is guaranteed to be the same as the order of {@code keyRecs}. If a record does not exist, the element at the corresponding index of the resulting collection is null.
Without those properties, getAll is not very useful: it is hard to correspond the results with the original collection.
Reproducer
Add the following code to ItTableApiContractTest:
@Test public void testGetAll() { RecordView<Tuple> tbl = ignite.tables().table(TABLE_NAME).recordView(); // recordView.insert(tx, Tuple.create().set("name", "k1").set("balance", 1)); var recs = IntStream.range(1, 50) .mapToObj(i -> Tuple.create().set("name", "id_" + i * 2).set("balance", i * 2)) .collect(Collectors.toList()); tbl.upsertAll(null, recs); var keys = IntStream.range(1, 100) .mapToObj(i -> Tuple.create().set("name", "id_" + i)) .collect(Collectors.toList()); List<Tuple> res = (List<Tuple>) tbl.getAll(null, keys); assertNull(res.get(0)); assertEquals(2L, res.get(1).longValue(0)); assertEquals(100, res.size()); }
Tuples are returned in random order, and only 50 of them, not 100
Attachments
Attachments
Issue Links
- blocks
-
IGNITE-16022 Thin 3.0: Optimize multi-row responses using guaranteed order
- Open
- is caused by
-
IGNITE-16004 Preserve key order in InternalTableImpl#collectMultiRowsResponses
- Resolved
- links to