use of com.hazelcast.query.impl.QueryableEntry in project hazelcast by hazelcast.
the class QueryRunner method runPartitionScanQueryOnGivenOwnedPartition.
Result runPartitionScanQueryOnGivenOwnedPartition(Query query, int partitionId) throws ExecutionException, InterruptedException {
MapContainer mapContainer = mapServiceContext.getMapContainer(query.getMapName());
Predicate predicate = queryOptimizer.optimize(query.getPredicate(), mapContainer.getIndexes());
Collection<QueryableEntry> entries = partitionScanExecutor.execute(query.getMapName(), predicate, Collections.singletonList(partitionId));
return populateTheResult(query, entries, Collections.singletonList(partitionId));
}
use of com.hazelcast.query.impl.QueryableEntry in project hazelcast by hazelcast.
the class QueryEventFilter method eval.
@Override
public boolean eval(Object arg) {
QueryableEntry entry = (QueryableEntry) arg;
Data keyData = entry.getKeyData();
return (key == null || key.equals(keyData)) && predicate.apply((Map.Entry) arg);
}
use of com.hazelcast.query.impl.QueryableEntry in project hazelcast by hazelcast.
the class QueryResultProcessor method populateResult.
@Override
public QueryResult populateResult(Query query, long resultLimit, Collection<QueryableEntry> entries, Collection<Integer> partitionIds) {
QueryResult result = new QueryResult(query.getIterationType(), resultLimit);
for (QueryableEntry entry : entries) {
result.add(entry, query.getProjection(), serializationService);
}
result.setPartitionIds(partitionIds);
return result;
}
use of com.hazelcast.query.impl.QueryableEntry in project hazelcast by hazelcast.
the class DefaultQueryCache method values.
@Override
public Collection<V> values(Predicate predicate) {
checkNotNull(predicate, "Predicate cannot be null!");
if (!includeValue) {
return Collections.emptySet();
}
Set<V> resultingSet = new HashSet<V>();
Set<QueryableEntry> query = indexes.query(predicate);
if (query != null) {
for (QueryableEntry entry : query) {
resultingSet.add((V) entry.getValue());
}
} else {
doFullValueScan(predicate, resultingSet);
}
return resultingSet;
}
use of com.hazelcast.query.impl.QueryableEntry in project hazelcast by hazelcast.
the class DefaultQueryCache method entrySet.
@Override
public Set<Map.Entry<K, V>> entrySet(Predicate predicate) {
checkNotNull(predicate, "Predicate cannot be null!");
Set<Map.Entry<K, V>> resultingSet = new HashSet<Map.Entry<K, V>>();
Set<QueryableEntry> query = indexes.query(predicate);
if (query != null) {
if (query.isEmpty()) {
return Collections.emptySet();
}
for (QueryableEntry entry : query) {
resultingSet.add(entry);
}
} else {
doFullEntryScan(predicate, resultingSet);
}
return resultingSet;
}
Aggregations