use of com.hazelcast.map.impl.query.QueryRunner in project hazelcast by hazelcast.
the class MapServiceContextImpl method createMapQueryRunner.
protected QueryRunner createMapQueryRunner(NodeEngine nodeEngine, QueryOptimizer queryOptimizer, ResultProcessorRegistry resultProcessorRegistry, PartitionScanRunner partitionScanRunner) {
boolean parallelEvaluation = nodeEngine.getProperties().getBoolean(QUERY_PREDICATE_PARALLEL_EVALUATION);
PartitionScanExecutor partitionScanExecutor;
if (parallelEvaluation) {
int opTimeoutInMillis = nodeEngine.getProperties().getInteger(OPERATION_CALL_TIMEOUT_MILLIS);
ManagedExecutorService queryExecutorService = nodeEngine.getExecutionService().getExecutor(QUERY_EXECUTOR);
partitionScanExecutor = new ParallelPartitionScanExecutor(partitionScanRunner, queryExecutorService, opTimeoutInMillis);
} else {
partitionScanExecutor = new CallerRunsPartitionScanExecutor(partitionScanRunner);
}
return new QueryRunner(this, queryOptimizer, partitionScanExecutor, resultProcessorRegistry);
}
use of com.hazelcast.map.impl.query.QueryRunner in project hazelcast by hazelcast.
the class MapFetchWithQueryOperation method runInternal.
@Override
protected void runInternal() {
QueryRunner runner = mapServiceContext.getMapQueryRunner(query.getMapName());
response = runner.runPartitionScanQueryOnPartitionChunk(query, getPartitionId(), pointers, fetchSize);
}
use of com.hazelcast.map.impl.query.QueryRunner in project hazelcast by hazelcast.
the class PartitionWideEntryWithPredicateOperationFactory method tryToObtainKeysFromIndexes.
/**
* Attempts to get keys by running an index query. This method may return
* {@code null} if there is an ongoing migration, which means that it is not
* safe to return results from a non-partition thread. The caller must then
* run a partition query to obtain the results.
*
* @param nodeEngine nodeEngine of this cluster node
* @return the set of keys or {@code null} if we failed to fetch the keys
* because of ongoing migrations
*/
private Set<Data> tryToObtainKeysFromIndexes(NodeEngine nodeEngine) {
// Do not use index in this case, because it requires full-table-scan.
if (predicate == Predicates.alwaysTrue()) {
return null;
}
MapService mapService = nodeEngine.getService(SERVICE_NAME);
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
MapContainer mapContainer = mapServiceContext.getMapContainer(name);
if (!mapContainer.shouldUseGlobalIndex()) {
return null;
}
QueryRunner runner = mapServiceContext.getMapQueryRunner(name);
Query query = Query.of().mapName(name).predicate(predicate).iterationType(IterationType.KEY).build();
final QueryResult result = (QueryResult) runner.runIndexQueryOnOwnedPartitions(query);
if (result.getPartitionIds() == null) {
// failed to run query because of ongoing migrations
return null;
}
final Builder<Data> setBuilder = InflatableSet.newBuilder(result.size());
for (QueryResultRow row : result.getRows()) {
setBuilder.add(row.getKey());
}
return setBuilder.build();
}
Aggregations