use of com.aerospike.client.query.Statement in project aerospike-client-java by aerospike.
the class TestQueryFilterSet method queryKeyInt.
@Test
public void queryKeyInt() {
Statement stmt = new Statement();
stmt.setNamespace(args.namespace);
stmt.setSetName(set3);
QueryPolicy policy = new QueryPolicy();
policy.filterExp = Exp.build(Exp.lt(Exp.key(Exp.Type.INT), Exp.val(35)));
RecordSet rs = client.query(policy, stmt);
try {
int count = 0;
while (rs.next()) {
// System.out.println(rs.getKey().toString() + " - " + rs.getRecord().toString());
count++;
}
assertEquals(4, count);
} finally {
rs.close();
}
}
use of com.aerospike.client.query.Statement in project aerospike-client-java by aerospike.
the class TestQueryFilterSet method queryDouble.
@Test
public void queryDouble() {
Statement stmt = new Statement();
stmt.setNamespace(args.namespace);
stmt.setSetName(set2);
QueryPolicy policy = new QueryPolicy();
policy.filterExp = Exp.build(Exp.gt(Exp.floatBin(binB), Exp.val(21.5)));
RecordSet rs = client.query(policy, stmt);
try {
int count = 0;
while (rs.next()) {
count++;
}
assertEquals(1, count);
} finally {
rs.close();
}
}
use of com.aerospike.client.query.Statement in project aerospike-client-java by aerospike.
the class TestQueryFilterSet method queryKeyExists.
@Test
public void queryKeyExists() {
Statement stmt = new Statement();
stmt.setNamespace(args.namespace);
stmt.setSetName(set3);
QueryPolicy policy = new QueryPolicy();
policy.filterExp = Exp.build(Exp.keyExists());
RecordSet rs = client.query(policy, stmt);
try {
int count = 0;
while (rs.next()) {
count++;
}
assertEquals(20, count);
} finally {
rs.close();
}
}
use of com.aerospike.client.query.Statement in project aerospike-client-java by aerospike.
the class TestQueryInteger method queryInteger.
@Test
public void queryInteger() {
int begin = 14;
int end = 18;
Statement stmt = new Statement();
stmt.setNamespace(args.namespace);
stmt.setSetName(args.set);
stmt.setBinNames(binName);
stmt.setFilter(Filter.range(binName, begin, end));
RecordSet rs = client.query(null, stmt);
try {
int count = 0;
while (rs.next()) {
count++;
}
assertEquals(5, count);
} finally {
rs.close();
}
}
use of com.aerospike.client.query.Statement in project aerospike-client-java by aerospike.
the class TestQueryRPS method bgScanWithUDF.
@Test
public void bgScanWithUDF() {
Statement stmt = new Statement();
stmt.setNamespace(args.namespace);
stmt.setSetName(args.set);
stmt.setRecordsPerSecond(rps);
ExecuteTask task = client.execute(null, stmt, "record_example", "processRecord", Value.get(binName2), Value.get(binName2), Value.get(100));
task.waitTillComplete();
for (Node n : client.getNodes()) {
checkRuntime(n, stmt);
}
}
Aggregations