I've been doing some experiments with Apache Ignite. I've developing a flexible object based on the following code
public static void main(String[] args) throws IgniteException {
Ignite start = Ignition.start("examples/config/example-ignite.xml");
CacheConfiguration<Integer, BinaryObject> cfg = new CacheConfiguration<>();
cfg.setQueryEntities(new ArrayList<QueryEntity>() {{
QueryEntity e = new QueryEntity();
e.setKeyType("java.lang.Integer");
e.setValueType("BinaryTest");
e.setFields(new LinkedHashMap<String, String>(){{
put("name", "java.lang.String");
}});
add(e);
}});
IgniteCache<Integer, BinaryObject> cache = start.getOrCreateCache(cfg).withKeepBinary();
BinaryObjectBuilder builder = start.binary().builder("BinaryTest");
builder.setField("name", "Test");
cache.put(1, builder.build());
QueryCursor<List<?>> query = cache.query(new SqlFieldsQuery("select name from BinaryTest"));
System.out.println(query.getAll());
However I don't want to have an index on every field (I suspect this is expensive). I realise that without an index this may result in slower queries - I'm fine with this.
Using the sample code above I can not form an SQL Query without first creating an index for that field.
Is it possible to use SQL queries on BinaryObjects without indexes? (Note: I will only ever store one 'type' of binary object per cache).
Indexes are created only when you explicitely ask for it. See [1] for details on how to configure them.
Note that SQL schema is currently static. So if you dynamically add a field to you cache data type (this is supported by binary format [2]), this field can't participate in a SQL query. To achieve that, you will need to recreate the cache with different configuration and reload the data. However, there is a ticket [3] to get rid of this limitation.
[1] https://apacheignite.readme.io/docs/sql-queries