nizhikov commented 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:
```
@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());
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));
}
}
```
The test fail with the following exception.
Looks like we can't read rows written the way you proposed.
Am I miss something? What is use-case to have `Object` indexes?
```
java.lang.AssertionError: id = 1
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.assertTrue(Assert.java:41)
at org.junit.Assert.assertNotNull(Assert.java:712)
at
org.apache.ignite.testframework.junits.JUnitAssertAware.assertNotNull(JUnitAssertAware.java:184)
at
org.apache.ignite.internal.processors.cache.index.BasicIndexTest.testCacheSecondaryCompositeIndex(BasicIndexTest.java:1584)
```
--
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]