Search in sources :

Example 1 with IterationType

use of com.hazelcast.internal.util.IterationType in project hazelcast by hazelcast.

the class PublisherCreateOperation method runInitialQuery.

private QueryResult runInitialQuery() {
    QueryEngine queryEngine = getMapServiceContext().getQueryEngine(name);
    IterationType iterationType = info.isIncludeValue() ? IterationType.ENTRY : IterationType.KEY;
    Query query = Query.of().mapName(name).predicate(info.getPredicate()).iterationType(iterationType).build();
    return queryEngine.execute(query, Target.LOCAL_NODE);
}
Also used : Query(com.hazelcast.map.impl.query.Query) IterationType(com.hazelcast.internal.util.IterationType) QueryEngine(com.hazelcast.map.impl.query.QueryEngine)

Example 2 with IterationType

use of com.hazelcast.internal.util.IterationType in project hazelcast by hazelcast.

the class PagingPredicateHolder method asPredicate.

public <K, V> Predicate<K, V> asPredicate(SerializationService serializationService) {
    List<Map.Entry<Integer, Map.Entry<K, V>>> anchorList = anchorDataListHolder.asAnchorList(serializationService);
    Predicate predicate = serializationService.toObject(predicateData);
    Comparator comparator = serializationService.toObject(comparatorData);
    IterationType iterationType = IterationType.getById(iterationTypeId);
    PagingPredicateImpl<K, V> pagingPredicate = new PagingPredicateImpl<K, V>(anchorList, predicate, comparator, pageSize, page, iterationType);
    if (partitionKeyData == null) {
        return pagingPredicate;
    }
    return new PartitionPredicateImpl<>(serializationService.toObject(partitionKeyData), pagingPredicate);
}
Also used : IterationType(com.hazelcast.internal.util.IterationType) PartitionPredicateImpl(com.hazelcast.query.impl.predicates.PartitionPredicateImpl) AbstractMap(java.util.AbstractMap) Map(java.util.Map) PartitionPredicate(com.hazelcast.query.PartitionPredicate) Predicate(com.hazelcast.query.Predicate) Comparator(java.util.Comparator) PagingPredicateImpl(com.hazelcast.query.impl.predicates.PagingPredicateImpl)

Example 3 with IterationType

use of com.hazelcast.internal.util.IterationType in project hazelcast by hazelcast.

the class QueryEngineImpl method adjustQuery.

private Query adjustQuery(Query query) {
    IterationType retrievalIterationType = getRetrievalIterationType(query.getPredicate(), query.getIterationType());
    Query adjustedQuery = Query.of(query).iterationType(retrievalIterationType).build();
    if (adjustedQuery.getPredicate() instanceof PagingPredicateImpl) {
        ((PagingPredicateImpl) adjustedQuery.getPredicate()).setIterationType(query.getIterationType());
    } else {
        if (adjustedQuery.getPredicate() == Predicates.alwaysTrue()) {
            queryResultSizeLimiter.precheckMaxResultLimitOnLocalPartitions(adjustedQuery.getMapName());
        }
    }
    return adjustedQuery;
}
Also used : IterationType(com.hazelcast.internal.util.IterationType) PagingPredicateImpl(com.hazelcast.query.impl.predicates.PagingPredicateImpl)

Aggregations

IterationType (com.hazelcast.internal.util.IterationType)3 PagingPredicateImpl (com.hazelcast.query.impl.predicates.PagingPredicateImpl)2 Query (com.hazelcast.map.impl.query.Query)1 QueryEngine (com.hazelcast.map.impl.query.QueryEngine)1 PartitionPredicate (com.hazelcast.query.PartitionPredicate)1 Predicate (com.hazelcast.query.Predicate)1 PartitionPredicateImpl (com.hazelcast.query.impl.predicates.PartitionPredicateImpl)1 AbstractMap (java.util.AbstractMap)1 Comparator (java.util.Comparator)1 Map (java.util.Map)1