use of com.hazelcast.map.impl.query.QueryResult in project hazelcast by hazelcast.
the class NodeQueryCacheEndToEndConstructor method populateWithoutValues.
private void populateWithoutValues(InternalQueryCache queryCache, Collection<QueryResult> resultSets) {
for (QueryResult queryResult : resultSets) {
try {
if (queryResult == null) {
continue;
}
for (QueryResultRow row : queryResult) {
Data dataKey = row.getKey();
queryCache.setInternal(dataKey, null, false, EntryEventType.ADDED);
}
} catch (Throwable t) {
throw ExceptionUtil.rethrow(t);
}
}
}
use of com.hazelcast.map.impl.query.QueryResult in project hazelcast by hazelcast.
the class NodeQueryCacheEndToEndConstructor method populateWithValues.
private void populateWithValues(InternalQueryCache queryCache, Collection<QueryResult> resultSets) {
for (QueryResult queryResult : resultSets) {
try {
if (queryResult == null) {
continue;
}
for (QueryResultRow row : queryResult) {
Data keyData = row.getKey();
Data valueData = row.getValue();
queryCache.setInternal(keyData, valueData, false, EntryEventType.ADDED);
}
} catch (Throwable t) {
throw ExceptionUtil.rethrow(t);
}
}
}
use of com.hazelcast.map.impl.query.QueryResult in project hazelcast by hazelcast.
the class MapPublisherCreateMessageTask method getQueryResults.
private Set<Data> getQueryResults(List<Future> futures) {
Set<Data> results = new HashSet<Data>(futures.size());
for (Future future : futures) {
Object result = null;
try {
result = future.get();
} catch (Throwable t) {
ExceptionUtil.rethrow(t);
}
if (result == null) {
continue;
}
QueryResult queryResult = (QueryResult) result;
for (QueryResultRow row : queryResult) {
results.add(row.getKey());
}
}
return results;
}
use of com.hazelcast.map.impl.query.QueryResult in project hazelcast by hazelcast.
the class TransactionalMapProxy method keySet.
@Override
@SuppressWarnings("unchecked")
public Set keySet(Predicate predicate) {
checkTransactionState();
checkNotNull(predicate, "Predicate should not be null!");
checkNotInstanceOf(PagingPredicate.class, predicate, "Paging is not supported for Transactional queries!");
MapQueryEngine queryEngine = mapServiceContext.getMapQueryEngine(name);
SerializationService serializationService = getNodeEngine().getSerializationService();
Query query = Query.of().mapName(name).predicate(predicate).iterationType(IterationType.KEY).build();
QueryResult queryResult = queryEngine.execute(query, Target.ALL_NODES);
Set result = QueryResultUtils.transformToSet(serializationService, queryResult, predicate, IterationType.KEY, true);
// TODO: Can't we just use the original set?
Set<Object> keySet = new HashSet<Object>(result);
Extractors extractors = mapServiceContext.getExtractors(name);
for (Map.Entry<Data, TxnValueWrapper> entry : txMap.entrySet()) {
Data keyData = entry.getKey();
if (!Type.REMOVED.equals(entry.getValue().type)) {
Object value = (entry.getValue().value instanceof Data) ? toObjectIfNeeded(entry.getValue().value) : entry.getValue().value;
QueryableEntry queryEntry = new CachedQueryEntry((InternalSerializationService) serializationService, keyData, value, extractors);
// apply predicate on txMap
if (predicate.apply(queryEntry)) {
Object keyObject = serializationService.toObject(keyData);
keySet.add(keyObject);
}
} else {
// meanwhile remove keys which are not in txMap
Object keyObject = serializationService.toObject(keyData);
keySet.remove(keyObject);
}
}
return keySet;
}
use of com.hazelcast.map.impl.query.QueryResult in project hazelcast by hazelcast.
the class PublisherCreateOperation method createSnapshot.
private QueryResult createSnapshot() throws Exception {
QueryResult queryResult = runInitialQuery();
replayEventsOnResultSet(queryResult);
return queryResult;
}
Aggregations