use of com.aerospike.client.query.Statement in project aerospike-client-java by aerospike.
the class TestQueryPredExp method queryPredicate4.
@Test
public void queryPredicate4() {
int begin = 1;
int end = 10;
Statement stmt = new Statement();
stmt.setNamespace(args.namespace);
stmt.setSetName(setName);
stmt.setFilter(Filter.range(binName, begin, end));
stmt.setPredExp(PredExp.integerVar("x"), PredExp.integerValue(4), PredExp.integerEqual(), PredExp.listBin("listbin"), PredExp.listIterateOr("x"));
/*
stmt.setPredicate(
Predicate.listInclude("listbin", "x", Predicate.var("x").equal(4))
);
*/
RecordSet rs = client.query(null, stmt);
try {
int count = 0;
while (rs.next()) {
// System.out.println(rs.getRecord().toString());
count++;
}
assertEquals(1, count);
} finally {
rs.close();
}
}
use of com.aerospike.client.query.Statement in project aerospike-client-java by aerospike.
the class TestQueryPredExp method queryPredicate9.
@Test
public void queryPredicate9() {
int begin = 1;
int end = 10;
Statement stmt = new Statement();
stmt.setNamespace(args.namespace);
stmt.setSetName(setName);
stmt.setFilter(Filter.range(binName, begin, end));
stmt.setPredExp(PredExp.stringVar("x"), PredExp.stringValue("AAA"), PredExp.stringUnequal(), PredExp.mapBin("mapbin"), PredExp.mapValIterateAnd("x"));
/*
stmt.setPredicate(
Predicate.mapValueExclude("mapbin", "x", Predicate.var("x").equal("AAA"))
);
*/
RecordSet rs = client.query(null, stmt);
try {
int count = 0;
while (rs.next()) {
// System.out.println(rs.getRecord().toString());
count++;
}
assertEquals(7, count);
} finally {
rs.close();
}
}
use of com.aerospike.client.query.Statement in project aerospike-client-java by aerospike.
the class TestQueryPredExp method queryPredicate10.
@Test
public void queryPredicate10() {
int begin = 1;
int end = 10;
Statement stmt = new Statement();
stmt.setNamespace(args.namespace);
stmt.setSetName(setName);
stmt.setFilter(Filter.range(binName, begin, end));
stmt.setPredExp(PredExp.recDigestModulo(3), PredExp.integerValue(1), PredExp.integerEqual());
RecordSet rs = client.query(null, stmt);
try {
int count = 0;
while (rs.next()) {
// System.out.println(rs.getRecord().toString());
count++;
}
assertEquals(2, count);
} finally {
rs.close();
}
}
use of com.aerospike.client.query.Statement in project aerospike-client-java by aerospike.
the class TestQueryPredExp method queryPredicate5.
@Test
public void queryPredicate5() {
int begin = 1;
int end = 10;
Statement stmt = new Statement();
stmt.setNamespace(args.namespace);
stmt.setSetName(setName);
stmt.setFilter(Filter.range(binName, begin, end));
stmt.setPredExp(PredExp.integerVar("x"), PredExp.integerValue(5), PredExp.integerUnequal(), PredExp.listBin("listbin"), PredExp.listIterateAnd("x"));
/*
stmt.setPredicate(
Predicate.listExclude("listbin", "x", Predicate.var("x").equal(5))
);
*/
RecordSet rs = client.query(null, stmt);
try {
int count = 0;
while (rs.next()) {
// System.out.println(rs.getRecord().toString());
count++;
}
assertEquals(8, count);
} finally {
rs.close();
}
}
use of com.aerospike.client.query.Statement in project aerospike-client-java by aerospike.
the class TestQueryPredExp method queryPredicate8.
@Test
public void queryPredicate8() {
int begin = 1;
int end = 10;
Statement stmt = new Statement();
stmt.setNamespace(args.namespace);
stmt.setSetName(setName);
stmt.setFilter(Filter.range(binName, begin, end));
stmt.setPredExp(PredExp.stringVar("x"), PredExp.stringValue("D"), PredExp.stringUnequal(), PredExp.mapBin("mapbin"), PredExp.mapKeyIterateAnd("x"));
/*
stmt.setPredicate(
Predicate.mapKeyExclude("mapbin", "x", Predicate.var("x").equal("D"))
);
*/
RecordSet rs = client.query(null, stmt);
try {
int count = 0;
while (rs.next()) {
// System.out.println(rs.getRecord().toString());
count++;
}
assertEquals(8, count);
} finally {
rs.close();
}
}
Aggregations