rezataroosheh commented on code in PR #13744:
URL: https://github.com/apache/ignite/pull/13744#discussion_r4372197264


##########
modules/indexing/src/test/java/org/apache/ignite/cache/query/IndexQueryLocalTest.java:
##########
@@ -99,6 +102,44 @@ public void testServerNodePartitionedCache() {
         assertEquals(CNT / 2, resultSize);
     }
 
+    /** Should return deserialized values for a cache that is not in 
keep-binary mode. */
+    @Test
+    public void testLocalQueryReturnsDeserializedValues() {
+        IgniteCache<Long, Person> cache = 
crd.createCache(ccfg(CacheMode.REPLICATED));
+
+        insertData(crd, cache);
+
+        IndexQuery<Long, Person> qry = new IndexQuery<Long, 
Person>(Person.class, IDX)
+            .setCriteria(lt("id", CNT / 2));
+
+        List<Cache.Entry<Long, Person>> res = 
cache.query(qry.setLocal(true)).getAll();
+
+        for (Cache.Entry<Long, Person> e : res)
+            assertEquals(new Person(e.getKey().intValue()), e.getValue());
+
+        assertEquals(CNT / 2, res.size());
+    }
+
+    /** Should keep binary values for a cache in keep-binary mode. */
+    @Test
+    public void testLocalQueryKeepBinaryReturnsBinaryValues() {
+        IgniteCache<Long, Person> cache = 
crd.createCache(ccfg(CacheMode.REPLICATED));

Review Comment:
   Thanks! Replaced the Long key with a PersonId POJO. Both tests now check the 
key and the value: the first checks that they deserialize; the keep-binary one 
checks that they come back as BinaryObject.



##########
modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/GridCacheQueryManager.java:
##########
@@ -1160,7 +1160,7 @@ public GridCloseableIterator indexQueryLocal(final 
CacheQuery qry) throws Ignite
                 private int cnt;
 
                 @Override protected Object onNext() throws 
IgniteCheckedException {
-                    IgniteBiTuple<K, V> entry = iter.nextX();
+                    IgniteBiTuple<K, V> entry = (IgniteBiTuple<K, 
V>)cctx.unwrapBinaryIfNeeded(iter.nextX(), qry.keepBinary(), false, null);

Review Comment:
   Done. The key and value are now unwrapped separately and passed directly to 
CacheEntryImpl, so no extra tuple is created.



-- 
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]

Reply via email to