[ 
https://issues.apache.org/jira/browse/IGNITE-19693?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Pavel Tupitsyn updated IGNITE-19693:
------------------------------------
    Description: 
* getAll does not preserve element order.
* getAll does not return nulls for non-existent records.

This is specified in Javadoc  in 
[RecordView|https://github.com/apache/ignite-3/blob/0c68cbe3f016e508bd9d53ce5320c88acba1acff/modules/api/src/main/java/org/apache/ignite/table/RecordView.java#L56-L60]:
{code}
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.
{code}

Without those properties, *getAll* is not very useful: it is hard to correspond 
the results with the original collection.

h2. Reproducer

Add the following code to *ItTableApiContractTest*:
{code:java}
    @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());
    }
{code}

Tuples are returned in random order, and only 50 of them, not 100

> getAll does not preserve order and does not return nulls for missing keys
> -------------------------------------------------------------------------
>
>                 Key: IGNITE-19693
>                 URL: https://issues.apache.org/jira/browse/IGNITE-19693
>             Project: Ignite
>          Issue Type: Bug
>          Components: cache
>    Affects Versions: 3.0.0-beta1
>            Reporter: Pavel Tupitsyn
>            Priority: Blocker
>              Labels: ignite-3
>             Fix For: 3.0.0-beta2
>
>
> * getAll does not preserve element order.
> * getAll does not return nulls for non-existent records.
> This is specified in Javadoc  in 
> [RecordView|https://github.com/apache/ignite-3/blob/0c68cbe3f016e508bd9d53ce5320c88acba1acff/modules/api/src/main/java/org/apache/ignite/table/RecordView.java#L56-L60]:
> {code}
> 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.
> {code}
> Without those properties, *getAll* is not very useful: it is hard to 
> correspond the results with the original collection.
> h2. Reproducer
> Add the following code to *ItTableApiContractTest*:
> {code:java}
>     @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());
>     }
> {code}
> Tuples are returned in random order, and only 50 of them, not 100



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to