Search in sources :

Example 1 with QueryAggregateExecutor

use of com.aerospike.client.query.QueryAggregateExecutor in project aerospike-client-java by aerospike.

the class AerospikeClient method queryAggregate.

/**
	 * Execute query, apply statement's aggregation function, and return result iterator.
	 * The aggregation function should be initialized via the statement's setAggregateFunction()
	 * and should be located in a resource or a filesystem file.
	 * <p>
	 * The query executor puts results on a queue in separate threads.  The calling thread
	 * concurrently pops results off the queue through the ResultSet iterator.
	 * The aggregation function is called on both server and client (final reduce).
	 * Therefore, the Lua script file must also reside on both server and client.
	 * 
	 * @param policy				generic configuration parameters, pass in null for defaults
	 * @param statement				database query command
	 * @throws AerospikeException	if query fails
	 */
public final ResultSet queryAggregate(QueryPolicy policy, Statement statement) throws AerospikeException {
    if (policy == null) {
        policy = queryPolicyDefault;
    }
    statement.prepare(true);
    QueryAggregateExecutor executor = new QueryAggregateExecutor(cluster, policy, statement, null);
    return executor.getResultSet();
}
Also used : QueryAggregateExecutor(com.aerospike.client.query.QueryAggregateExecutor)

Example 2 with QueryAggregateExecutor

use of com.aerospike.client.query.QueryAggregateExecutor in project aerospike-client-java by aerospike.

the class AerospikeClient method queryAggregateNode.

/**
	 * Execute query on a single server node, apply statement's aggregation function, and return 
	 * result iterator.
	 * The aggregation function should be initialized via the statement's setAggregateFunction()
	 * and should be located in a resource or a filesystem file.
	 * <p>
	 * The query executor puts results on a queue in separate threads.  The calling thread
	 * concurrently pops results off the queue through the ResultSet iterator.
	 * The aggregation function is called on both server and client (final reduce).
	 * Therefore, the Lua script file must also reside on both server and client.
	 * 
	 * @param policy				generic configuration parameters, pass in null for defaults
	 * @param statement				database query command
	 * @param node					server node to execute query
	 * @throws AerospikeException	if query fails
	 */
public final ResultSet queryAggregateNode(QueryPolicy policy, Statement statement, Node node) throws AerospikeException {
    if (policy == null) {
        policy = queryPolicyDefault;
    }
    statement.prepare(true);
    QueryAggregateExecutor executor = new QueryAggregateExecutor(cluster, policy, statement, node);
    return executor.getResultSet();
}
Also used : QueryAggregateExecutor(com.aerospike.client.query.QueryAggregateExecutor)

Aggregations

QueryAggregateExecutor (com.aerospike.client.query.QueryAggregateExecutor)2