Hello Igniters. If type of binary field does not match query entity field type we still able to insert such entry into cache, but can't query it. In the following example we have query entity with the UUID field "name", but we insert String field "name" using binary object.
IgniteCache<Object, Object> cache = grid(0).createCache( new CacheConfiguration<>("testCache").setQueryEntities( Collections.singletonList( new QueryEntity() .setKeyFieldName("id") .setValueType("Person") .setFields(new LinkedHashMap<>( F.asMap("id", "java.lang.Integer", "name", "java.util.UUID")))))); BinaryObject obj = grid(0).binary().builder("Person") .setField("id", 1) .setField("name", UUID.randomUUID().toString()) .build(); cache.put(1, obj); assertEquals(obj, cache.withKeepBinary().get(1)); String sql = "select id, name from Person where id=1"; grid(0).context().query() .querySqlFields(new SqlFieldsQuery(sql).setSchema("testCache"), true) .getAll(); // java.lang.ClassCastException: java.lang.String cannot be cast to java.util.UUID The object was successfully inserted, but the "name"-field cannot be read using sql. Should it be better to prevent insertion of cache entry if the binary field type and the type of the query entity field do not match?