use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.
the class MapIndexScanPTest method test_whenFilterAndSpecificProjectionExists_sorted.
@Test
public void test_whenFilterAndSpecificProjectionExists_sorted() {
List<JetSqlRow> expected = new ArrayList<>();
for (int i = count; i > 0; i--) {
map.put(i, new Person("value-" + i, i));
if (i > count / 2) {
expected.add(jetRow((count - i + 1), "value-" + (count - i + 1), (count - i + 1)));
}
}
IndexConfig indexConfig = new IndexConfig(IndexType.SORTED, "age").setName(randomName());
map.addIndex(indexConfig);
IndexFilter filter = new IndexRangeFilter(intValue(0), true, intValue(count / 2), true);
MapIndexScanMetadata metadata = metadata(indexConfig.getName(), filter, 0, false);
TestSupport.verifyProcessor(adaptSupplier(MapIndexScanP.readMapIndexSupplier(metadata))).hazelcastInstance(instance()).jobConfig(new JobConfig().setArgument(SQL_ARGUMENTS_KEY_NAME, emptyList())).outputChecker(LENIENT_SAME_ITEMS_IN_ORDER).disableSnapshots().disableProgressAssertion().expectOutput(expected);
}
use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.
the class MapIndexScanPTest method test_fullScanAsc_sorted.
@Test
public void test_fullScanAsc_sorted() {
List<JetSqlRow> expected = new ArrayList<>();
for (int i = count; i > 0; i--) {
map.put(i, new Person("value-" + i, i));
expected.add(jetRow((count - i + 1), "value-" + (count - i + 1), (count - i + 1)));
}
IndexConfig indexConfig = new IndexConfig(IndexType.SORTED, "age").setName(randomName());
map.addIndex(indexConfig);
IndexFilter filter = new IndexRangeFilter(null, true, null, true);
MapIndexScanMetadata metadata = metadata(indexConfig.getName(), filter, 2, false);
TestSupport.verifyProcessor(adaptSupplier(MapIndexScanP.readMapIndexSupplier(metadata))).hazelcastInstance(instance()).jobConfig(new JobConfig().setArgument(SQL_ARGUMENTS_KEY_NAME, emptyList())).outputChecker(LENIENT_SAME_ITEMS_IN_ORDER).disableSnapshots().disableProgressAssertion().expectOutput(expected);
}
use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.
the class MapIndexScanPTest method test_fullScanDesc_sorted.
@Test
public void test_fullScanDesc_sorted() {
List<JetSqlRow> expected = new ArrayList<>();
for (int i = 0; i <= count; i++) {
map.put(i, new Person("value-" + i, i));
expected.add(jetRow((count - i), "value-" + (count - i), (count - i)));
}
IndexConfig indexConfig = new IndexConfig(IndexType.SORTED, "age").setName(randomName());
map.addIndex(indexConfig);
IndexFilter filter = new IndexRangeFilter(null, true, null, true);
MapIndexScanMetadata metadata = metadata(indexConfig.getName(), filter, 2, true);
TestSupport.verifyProcessor(adaptSupplier(MapIndexScanP.readMapIndexSupplier(metadata))).hazelcastInstance(instance()).jobConfig(new JobConfig().setArgument(SQL_ARGUMENTS_KEY_NAME, emptyList())).outputChecker(LENIENT_SAME_ITEMS_IN_ORDER).disableSnapshots().disableProgressAssertion().expectOutput(expected);
}
use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.
the class QueryCacheYamlConfigBuilderHelper method queryCacheIndexesHandle.
@Override
protected void queryCacheIndexesHandle(Node childNode, QueryCacheConfig queryCacheConfig) {
for (Node indexNode : childElements(childNode)) {
IndexConfig indexConfig = IndexUtils.getIndexConfigFromYaml(indexNode, domLevel3, strict);
queryCacheConfig.addIndexConfig(indexConfig);
}
}
use of com.hazelcast.config.IndexConfig in project hazelcast by hazelcast.
the class ClientMapProxy method addIndex.
@Override
public void addIndex(IndexConfig indexConfig) {
checkNotNull(indexConfig, "Index config cannot be null.");
IndexConfig indexConfig0 = IndexUtils.validateAndNormalize(name, indexConfig);
ClientMessage request = MapAddIndexCodec.encodeRequest(name, indexConfig0);
invoke(request);
}
Aggregations