use of com.hazelcast.query.impl.predicates.RuleBasedQueryOptimizer in project hazelcast by hazelcast.
the class PagingPredicateOptimizationTest method testInnerPredicateOptimization.
@Test
public void testInnerPredicateOptimization() {
RuleBasedQueryOptimizer optimizer = new RuleBasedQueryOptimizer();
Indexes indexes = mock(Indexes.class);
Predicate[] orPredicates = new Predicate[10];
for (int i = 0; i < orPredicates.length; ++i) {
orPredicates[i] = Predicates.equal("a", i);
}
Predicate innerPredicate = Predicates.or(orPredicates);
PagingPredicate<Object, Object> pagingPredicate = Predicates.pagingPredicate(innerPredicate, 10);
Predicate optimized = optimizer.optimize(pagingPredicate, indexes);
assertInstanceOf(PagingPredicateImpl.class, optimized);
Predicate innerOptimized = ((PagingPredicateImpl) optimized).getPredicate();
assertInstanceOf(InPredicate.class, innerOptimized);
}
Aggregations