use of org.apache.geode.cache.query.internal.ExecutionContext in project geode by apache.
the class CqServiceImpl method evaluateQuery.
/**
* Applies the query on the event. This method takes care of the performance related changed done
* to improve the CQ-query performance. When CQ-query is executed first time, it saves the query
* related information in the execution context and uses that info in later executions.
*/
private boolean evaluateQuery(CqQueryImpl cQuery, Object[] event) throws Exception {
ExecutionContext execContext = cQuery.getQueryExecutionContext();
execContext.reset();
execContext.setBindArguments(event);
boolean status = false;
// ExecutionContext.
if (execContext.getScopeNum() <= 0) {
SelectResults results = (SelectResults) ((DefaultQuery) cQuery.getQuery()).executeUsingContext(execContext);
if (results != null && results.size() > 0) {
status = true;
}
} else {
// Execute using the saved query info (in ExecutionContext).
// This avoids building resultSet, index look-up, generating build-plans
// that are not required for; query execution on single object.
CompiledSelect cs = ((DefaultQuery) (cQuery.getQuery())).getSelect();
status = cs.evaluateCq(execContext);
}
return status;
}
Aggregations