Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-19693

getAll does not preserve order and does not return nulls for missing keys

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Blocker
    • Resolution: Fixed
    • 3.0.0-beta1
    • 3.0
    • cache

    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

        Issue Links

          Activity

            People

              ktkalenko@gridgain.com Kirill Tkalenko
              ptupitsyn Pavel Tupitsyn
              Roman Puchkovskiy Roman Puchkovskiy
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m