use of com.hazelcast.query.impl.getters.Extractors in project hazelcast by hazelcast.
the class LikePredicateTest method createIndex.
@Nonnull
private Index createIndex(IndexType indexType) {
InternalSerializationService mockSerializationService = mock(InternalSerializationService.class);
Extractors mockExtractors = Extractors.newBuilder(mockSerializationService).build();
IndexConfig config = IndexUtils.createTestIndexConfig(indexType, "this");
return new IndexImpl(config, mockSerializationService, mockExtractors, IndexCopyBehavior.COPY_ON_READ, PerIndexStats.EMPTY, MemberPartitionStateImpl.DEFAULT_PARTITION_COUNT);
}
use of com.hazelcast.query.impl.getters.Extractors in project hazelcast by hazelcast.
the class GenericQueryTargetTest method createTarget.
private static GenericQueryTarget createTarget(boolean key) {
InternalSerializationService ss = new DefaultSerializationServiceBuilder().build();
Extractors extractors = Extractors.newBuilder(ss).build();
GenericQueryTargetDescriptor descriptor = new GenericQueryTargetDescriptor();
GenericQueryTarget target = (GenericQueryTarget) descriptor.create(ss, extractors, key);
assertEquals(key, target.isKey());
return target;
}
use of com.hazelcast.query.impl.getters.Extractors in project hazelcast by hazelcast.
the class PartitionScanRunner method run.
@SuppressWarnings("unchecked")
public Collection<QueryableEntry> run(String mapName, Predicate predicate, int partitionId) {
PagingPredicate pagingPredicate = predicate instanceof PagingPredicate ? (PagingPredicate) predicate : null;
List<QueryableEntry> resultList = new LinkedList<QueryableEntry>();
PartitionContainer partitionContainer = mapServiceContext.getPartitionContainer(partitionId);
MapContainer mapContainer = mapServiceContext.getMapContainer(mapName);
Iterator<Record> iterator = partitionContainer.getRecordStore(mapName).loadAwareIterator(getNow(), false);
Map.Entry<Integer, Map.Entry> nearestAnchorEntry = getNearestAnchorEntry(pagingPredicate);
boolean useCachedValues = isUseCachedDeserializedValuesEnabled(mapContainer);
Extractors extractors = mapServiceContext.getExtractors(mapName);
while (iterator.hasNext()) {
Record record = iterator.next();
Data key = (Data) toData(record.getKey());
Object value = toData(useCachedValues ? Records.getValueOrCachedValue(record, serializationService) : record.getValue());
if (value == null) {
continue;
}
//we want to always use CachedQueryEntry as these are short-living objects anyway
QueryableEntry queryEntry = new CachedQueryEntry(serializationService, key, value, extractors);
if (predicate.apply(queryEntry) && compareAnchor(pagingPredicate, queryEntry, nearestAnchorEntry)) {
resultList.add(queryEntry);
}
}
return getSortedSubList(resultList, pagingPredicate, nearestAnchorEntry);
}
use of com.hazelcast.query.impl.getters.Extractors in project hazelcast by hazelcast.
the class HazelcastJsonQueryTargetDescriptorTest method test_create.
@Test
@Parameters({ "true", "false" })
public void test_create(boolean key) {
Extractors extractors = Extractors.newBuilder(SERIALIZATION_SERVICE).build();
HazelcastJsonQueryTargetDescriptor descriptor = HazelcastJsonQueryTargetDescriptor.INSTANCE;
// when
QueryTarget target = descriptor.create(SERIALIZATION_SERVICE, extractors, key);
// then
assertThat(target).isInstanceOf(HazelcastJsonQueryTarget.class);
}
use of com.hazelcast.query.impl.getters.Extractors in project hazelcast by hazelcast.
the class AvroQueryTargetDescriptorTest method test_create.
@Test
@Parameters({ "true", "false" })
public void test_create(boolean key) {
Extractors extractors = Extractors.newBuilder(SERIALIZATION_SERVICE).build();
AvroQueryTargetDescriptor descriptor = AvroQueryTargetDescriptor.INSTANCE;
// when
QueryTarget target = descriptor.create(SERIALIZATION_SERVICE, extractors, key);
// then
assertThat(target).isInstanceOf(AvroQueryTarget.class);
}
Aggregations