Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in com.hazelcast.query.Predicates.NotEqualPredicate #262

steffentemplin opened this issue Sep 4, 2012 · 0 comments


None yet
2 participants
Copy link

commented Sep 4, 2012


i recently started to work with the criteria API for distributed maps and experienced wrong results with a not-equal-comparison between two integer values on indexed fields. This happens for me with Hazelcast 2.3.1:

NotEqualPredicate.filter() calls Index.getSubRecords(false, false, searchValue). In this case the first boolean means "not a less than-comparison" and the second one means "not a equal-comparison". This causes wrong results, because both IndexStore implementations are performing a greater-than-comparison in this case (whats indeed the right implication of the combination of both booleans i think). This can easily be tested:

public void testNotEqualPredicate() throws Exception {
    HazelcastInstance hazelcast = getHazelcastInstance();
    IMap<String, MapValue> map = hazelcast.getMap("mapName");
    map.addIndex("value", false);
    map.put("key1", new MapValue(1));

    EntryObject entryObject = new PredicateBuilder().getEntryObject().get("value");
    PredicateBuilder notEqualPredicate = entryObject.notEqual(5);
    Collection<MapValue> values = map.values(notEqualPredicate);

private static final class MapValue implements Serializable {

    private final int value;

    public MapValue(int value) {
        this.value = value;

    public int getValue() {
        return value;



@ghost ghost assigned mdogan Sep 5, 2012

@mdogan mdogan closed this in f037df9 Sep 22, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.