use of com.hazelcast.sql.impl.exec.scan.MapIndexScanMetadata in project hazelcast by hazelcast.
the class MapIndexScanPTest method test_pointLookup_hashed.
// We also don't test full hash index scan, because such plan aren't allowed to be created.
@Test
public void test_pointLookup_hashed() {
List<JetSqlRow> expected = new ArrayList<>();
for (int i = count; i > 0; i--) {
map.put(i, new Person("value-" + i, i));
}
expected.add(jetRow((5), "value-5", 5));
IndexConfig indexConfig = new IndexConfig(IndexType.HASH, "age").setName(randomName());
map.addIndex(indexConfig);
IndexFilter filter = new IndexEqualsFilter(intValue(5));
MapIndexScanMetadata metadata = metadata(indexConfig.getName(), filter, -1, 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.sql.impl.exec.scan.MapIndexScanMetadata in project hazelcast by hazelcast.
the class MapIndexScanPTest method test_whenFilterExistsWithoutSpecificProjection_sorted.
@Test
public void test_whenFilterExistsWithoutSpecificProjection_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, 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.sql.impl.exec.scan.MapIndexScanMetadata in project hazelcast by hazelcast.
the class JetSqlSerializerHook method createFactory.
@SuppressWarnings("unchecked")
@Override
public DataSerializableFactory createFactory() {
ConstructorFunction<Integer, IdentifiedDataSerializable>[] constructors = new ConstructorFunction[LEN];
constructors[JSON_QUERY] = arg -> new JsonQueryFunction();
constructors[JSON_PARSE] = arg -> new JsonParseFunction();
constructors[JSON_VALUE] = arg -> new JsonValueFunction<>();
constructors[JSON_OBJECT] = arg -> new JsonObjectFunction();
constructors[JSON_ARRAY] = arg -> new JsonArrayFunction();
constructors[MAP_INDEX_SCAN_METADATA] = arg -> new MapIndexScanMetadata();
constructors[ROW_PROJECTOR_PROCESSOR_SUPPLIER] = arg -> new RowProjectorProcessorSupplier();
constructors[KV_ROW_PROJECTOR_SUPPLIER] = arg -> new KvRowProjector.Supplier();
constructors[ROOT_RESULT_CONSUMER_SINK_SUPPLIER] = arg -> new RootResultConsumerSink.Supplier();
constructors[SQL_ROW_COMPARATOR] = arg -> new ExpressionUtil.SqlRowComparator();
constructors[FIELD_COLLATION] = arg -> new FieldCollation();
constructors[ROW_GET_MAYBE_SERIALIZED_FN] = arg -> new AggregateAbstractPhysicalRule.RowGetMaybeSerializedFn();
constructors[NULL_FUNCTION] = arg -> AggregateAbstractPhysicalRule.NullFunction.INSTANCE;
constructors[ROW_GET_FN] = arg -> new AggregateAbstractPhysicalRule.RowGetFn();
constructors[AGGREGATE_CREATE_SUPPLIER] = arg -> new AggregateAbstractPhysicalRule.AggregateCreateSupplier();
constructors[AGGREGATE_ACCUMULATE_FUNCTION] = arg -> new AggregateAbstractPhysicalRule.AggregateAccumulateFunction();
constructors[AGGREGATE_COMBINE_FUNCTION] = arg -> AggregateAbstractPhysicalRule.AggregateCombineFunction.INSTANCE;
constructors[AGGREGATE_EXPORT_FINISH_FUNCTION] = arg -> AggregateAbstractPhysicalRule.AggregateExportFinishFunction.INSTANCE;
constructors[AGGREGATE_SUM_SUPPLIER] = arg -> new AggregateAbstractPhysicalRule.AggregateSumSupplier();
constructors[AGGREGATE_AVG_SUPPLIER] = arg -> new AggregateAbstractPhysicalRule.AggregateAvgSupplier();
constructors[AGGREGATE_COUNT_SUPPLIER] = arg -> new AggregateAbstractPhysicalRule.AggregateCountSupplier();
return new ArrayDataSerializableFactory(constructors);
}
Aggregations