nizhikov edited a comment on pull request #9618:
URL: https://github.com/apache/ignite/pull/9618#issuecomment-1000291426


   @vladErmakov07 ~I still don't quite understand the use-case and fix.
   Extend your test a bit and stuck:~
   
   Sorry test miss main line and now it passes - can we extend it in PR?
   
   ```
       @Test
       public void testCacheSecondaryCompositeIndex() throws Exception {
           inlineSize = 70;
           
           startGrid();
           
           String cacheName = "TEST";
   
           List<QueryIndex> indexes = Collections.singletonList(
               new QueryIndex("val_obj", 
QueryIndexType.SORTED).setInlineSize(inlineSize)
           );
   
           grid().createCache(new CacheConfiguration<>()
               .setName(cacheName)
               .setSqlSchema(cacheName)
               .setAffinity(new RendezvousAffinityFunction(false, 4))
               .setQueryEntities(Collections.singleton(new QueryEntity()
                   .setTableName(cacheName)
                   .setKeyType(Integer.class.getName())
                   .setKeyFieldName("id")
                   .setValueType("TEST_VAL_SECONDARY_COMPOSITE")
                   .addQueryField("id", Integer.class.getName(), null)
                   .addQueryField("val_obj", Object.class.getName(), null)
                   .setIndexes(indexes)
               ))
           );
           
           BinaryObjectBuilder bob = 
grid().binary().builder("TEST_VAL_SECONDARY_COMPOSITE");
           BinaryObjectBuilder bobInner = grid().binary().builder("inner");
           
           bobInner.setField("inner_k", 0);
           bobInner.setField("inner_uuid", UUID.randomUUID());
           
           bob.setField("val_obj", bobInner.build());
   
   
           IgniteCache<Object, Object> cache = grid().cache(cacheName);
   
           cache.put(0, bob.build());
   
           BinaryObjectBuilder alice = 
grid().binary().builder("TEST_VAL_SECONDARY_COMPOSITE");
           BinaryObjectBuilder aliceInner = grid().binary().builder("inner2");
   
           aliceInner.setField("inner_k2", 0);
           aliceInner.setField("inner_uuid2", UUID.randomUUID());
   
           alice.setField("val_obj", aliceInner.build());
   
           cache.put(1, alice.build());
   
           List<List<?>> rows = execSql(cache.withKeepBinary(), "SELECT id, 
val_obj FROM " + cacheName);
   
           assertEquals(2, rows.size());
   
           for (List<?> row : rows) {
               assertNotNull(row.get(0));
               assertNotNull("id = " + row.get(0), row.get(1));
           }
       }
   ```


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