PredExp vs Expression - Aerospike Client (list of integers)

83 views Asked by At

What would be the Expression substitute for the below code which uses PredExp for aerospike client

predExps = Arrays.asList(PredExp.integerVar("v"), PredExp.integerValue((Long) fieldValue),       PredExp.integerEqual(), PredExp.listBin(fieldName), PredExp.listIterateOr("v"));

Not able to figure out how to replicate the list behaviour here.

Tried to replicate the same behaviour using Exp.intOr but that is not working

1

There are 1 answers

2
kporter On

Your predexp is checking if any value in a list matches a particular value:

predExps = Arrays.asList(
         PredExp.integerVar("v"),
         PredExp.integerValue((Long) fieldValue),
         PredExp.integerEqual(),
         PredExp.listBin(fieldName),
         PredExp.listIterateOr("v")
);

The equivalent in expression is to use the list_get_by_value() expression. Should be similar to the following in Java - I'm currently unable to test:

Exp.build(
    ListExp.getByValue(
        ListReturnType.EXISTS, Exp.val(fieldValue), Exp.listBin(fieldName)))