use of com.aerospike.client.query.Statement in project aerospike-client-java by aerospike.
the class TestQueryRPS method queryAggregation.
@Ignore
@Test
public void queryAggregation() {
Statement stmt = new Statement();
stmt.setNamespace(args.namespace);
stmt.setSetName(args.set);
stmt.setBinNames(binName1);
stmt.setFilter(Filter.range(binName1, 0, n_records));
stmt.setAggregateFunction(TestQuerySum.class.getClassLoader(), "udf/sum_example.lua", "sum_example", "sum_single_bin", Value.get(binName1));
stmt.setRecordsPerSecond(rps);
ResultSet rs = client.queryAggregate(null, stmt);
try {
while (rs.next()) {
}
} finally {
rs.close();
}
for (Node n : client.getNodes()) {
checkRuntime(n, stmt);
}
}
use of com.aerospike.client.query.Statement in project aerospike-client-java by aerospike.
the class TestQueryRPS method bgScanWithOps.
@Test
public void bgScanWithOps() {
Statement stmt = new Statement();
stmt.setNamespace(args.namespace);
stmt.setSetName(args.set);
stmt.setRecordsPerSecond(rps);
ExecuteTask task = client.execute(null, stmt, Operation.put(new Bin(binName3, 1)));
task.waitTillComplete();
for (Node n : client.getNodes()) {
checkRuntime(n, stmt);
}
}
use of com.aerospike.client.query.Statement in project aerospike-client-java by aerospike.
the class TestQueryRPS method query.
@Ignore
@Test
public void query() {
Statement stmt = new Statement();
stmt.setNamespace(args.namespace);
stmt.setSetName(args.set);
stmt.setFilter(Filter.range(binName1, 0, n_records));
stmt.setRecordsPerSecond(rps);
RecordSet rs = client.query(null, stmt);
drainRecords(rs);
for (Node n : client.getNodes()) {
checkRuntime(n, stmt);
}
}
use of com.aerospike.client.query.Statement in project aerospike-client-java by aerospike.
the class TestQueryGeo method queryGeo1.
@Test
public void queryGeo1() {
String region = "{ \"type\": \"Point\", \"coordinates\": [ -122.0986857, 37.4214209 ] }";
Statement stmt = new Statement();
stmt.setNamespace(args.namespace);
stmt.setSetName(setNameRegions);
QueryPolicy policy = new QueryPolicy();
policy.filterExp = Exp.build(Exp.geoCompare(Exp.geoBin("loc"), Exp.geo(region)));
RecordSet rs = client.query(policy, stmt);
try {
int count = 0;
while (rs.next()) {
// System.out.println(rs.getRecord().toString());
count++;
}
assertEquals(5, count);
} finally {
rs.close();
}
}
use of com.aerospike.client.query.Statement in project aerospike-client-java by aerospike.
the class TestQueryKey method queryKey.
@Test
public void queryKey() {
int begin = 2;
int end = 5;
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()) {
Key key = rs.getKey();
assertNotNull(key.userKey);
Object userkey = key.userKey.getObject();
assertNotNull(userkey);
count++;
}
assertEquals(4, count);
} finally {
rs.close();
}
}
Aggregations