I'm new to hazelcast, trying to implement a look up using hazelcast. My scenario is, I have a range of numbers 1-10,10-20,20-30 ... . If I get a request with a number then I need to return the range which it belong to, for example if the request comes with number 22, then I should be returning the 20-30 range.
Is it possible with hazelcast query ? if you have done similar implementation, appreciate if you can please share .
The SQL query we execute to find this is
select * from table where '10' between MIN and MAX value
Sure thing. Hazelcast provides predicates that enable you to perform sql operations. For instance:
Predicate sqlQuery = new SqlPredicate("age BETWEEN (18 AND 21)");
Collection result1 = users.values(sqlQuery);
Would return all the map entries with an age between 18 and 21.
More information can be found here: https://docs.hazelcast.org/docs/latest/javadoc/com/hazelcast/query/Predicates.html#between-java.lang.String-java.lang.Comparable-java.lang.Comparable-