use of com.hazelcast.sql.impl.extract.QueryPath in project hazelcast by hazelcast.
the class SqlIndexAbstractTest method checkPlan.
private void checkPlan(boolean withIndex, String sql) {
List<QueryDataType> parameterTypes = asList(QueryDataType.INT, f1.getFieldConverterType(), f2.getFieldConverterType());
List<TableField> mapTableFields = asList(new MapTableField("__key", QueryDataType.INT, false, QueryPath.KEY_PATH), new MapTableField("field1", f1.getFieldConverterType(), false, new QueryPath("field1", false)), new MapTableField("field2", f2.getFieldConverterType(), false, new QueryPath("field2", false)));
HazelcastTable table = partitionedTable(mapName, mapTableFields, getPartitionedMapIndexes(mapContainer(map), mapTableFields), map.size());
OptimizerTestSupport.Result optimizationResult = optimizePhysical(sql, parameterTypes, table);
assertPlan(optimizationResult.getLogical(), plan(planRow(0, FullScanLogicalRel.class)));
assertPlan(optimizationResult.getPhysical(), plan(planRow(0, withIndex ? IndexScanMapPhysicalRel.class : FullScanPhysicalRel.class)));
}
use of com.hazelcast.sql.impl.extract.QueryPath in project hazelcast by hazelcast.
the class SqlIndexCastTest method checkIndexUsage.
private void checkIndexUsage(SqlStatement statement, ExpressionType<?> field, boolean expectedIndexUsage) {
List<QueryDataType> parameterTypes = asList(QueryDataType.INT, field.getFieldConverterType());
List<TableField> mapTableFields = asList(new MapTableField("__key", QueryDataType.INT, false, QueryPath.KEY_PATH), new MapTableField("field1", field.getFieldConverterType(), false, new QueryPath("field1", false)));
HazelcastTable table = partitionedTable(MAP_NAME, mapTableFields, getPartitionedMapIndexes(mapContainer(instance().getMap(MAP_NAME)), mapTableFields), 1);
Result optimizationResult = optimizePhysical(statement.getSql(), parameterTypes, table);
assertPlan(optimizationResult.getLogical(), plan(planRow(0, FullScanLogicalRel.class)));
assertPlan(optimizationResult.getPhysical(), plan(planRow(0, expectedIndexUsage ? IndexScanMapPhysicalRel.class : FullScanPhysicalRel.class)));
}
use of com.hazelcast.sql.impl.extract.QueryPath in project hazelcast by hazelcast.
the class SqlIndexFromSearchFilterTest method table.
private HazelcastTable table() {
List<TableField> mapTableFields = asList(new MapTableField("__key", QueryDataType.INT, false, QueryPath.KEY_PATH), new MapTableField("field1", INTEGER.getFieldConverterType(), false, new QueryPath("field1", false)), new MapTableField("field2", INTEGER.getFieldConverterType(), false, new QueryPath("field2", false)));
HazelcastTable table = partitionedTable(mapName, mapTableFields, getPartitionedMapIndexes(mapContainer(instance().getMap(mapName)), mapTableFields), MAP_SIZE);
return table;
}
use of com.hazelcast.sql.impl.extract.QueryPath in project hazelcast by hazelcast.
the class KvMetadataAvroResolverTest method when_noKeyOrThisPrefixInExternalName_then_usesValue.
@Test
@Parameters({ "true", "false" })
public void when_noKeyOrThisPrefixInExternalName_then_usesValue(boolean key) {
KvMetadata metadata = INSTANCE.resolveMetadata(key, singletonList(field("field", QueryDataType.INT, "extField")), emptyMap(), null);
assertThat(metadata.getFields()).containsExactly(key ? new MapTableField[] { new MapTableField("__key", QueryDataType.OBJECT, true, QueryPath.KEY_PATH) } : new MapTableField[] { new MapTableField("field", QueryDataType.INT, false, new QueryPath("extField", false)), new MapTableField("this", QueryDataType.OBJECT, true, QueryPath.VALUE_PATH) });
}
use of com.hazelcast.sql.impl.extract.QueryPath in project hazelcast by hazelcast.
the class KvMetadataJavaResolverTest method when_noKeyOrThisPrefixInExternalName_then_usesValue.
@Test
@Parameters({ "true", "false" })
public void when_noKeyOrThisPrefixInExternalName_then_usesValue(boolean key) {
Map<String, String> options = ImmutableMap.of((key ? OPTION_KEY_FORMAT : OPTION_VALUE_FORMAT), JAVA_FORMAT, (key ? OPTION_KEY_CLASS : OPTION_VALUE_CLASS), Object.class.getName());
KvMetadata metadata = INSTANCE.resolveMetadata(key, singletonList(field("field", QueryDataType.INT, "extField")), options, null);
assertThat(metadata.getFields()).containsExactly(key ? new MapTableField[] { new MapTableField("__key", QueryDataType.OBJECT, true, QueryPath.KEY_PATH) } : new MapTableField[] { new MapTableField("field", QueryDataType.INT, false, new QueryPath("extField", false)), new MapTableField("this", QueryDataType.OBJECT, true, QueryPath.VALUE_PATH) });
}
Aggregations