use of com.hazelcast.jet.sql.impl.schema.HazelcastTable in project hazelcast by hazelcast.
the class LogicalSelectTest method test_selectByKeyAndKey.
@Test
public void test_selectByKeyAndKey() {
HazelcastTable table = partitionedTable("m", asList(field(KEY, INT), field(VALUE, VARCHAR)), 10);
assertPlan(optimizeLogical("SELECT * FROM m WHERE __key = 1 AND __key = 2", table), plan(planRow(0, ValuesLogicalRel.class)));
}
use of com.hazelcast.jet.sql.impl.schema.HazelcastTable in project hazelcast by hazelcast.
the class LogicalSelectTest method test_selectByKeyWithDynamicParam.
@Test
@Parameters(method = "types")
public void test_selectByKeyWithDynamicParam(QueryDataType type) {
HazelcastTable table = partitionedTable("m", asList(field(KEY, type), field(VALUE, VARCHAR)), 1);
assertPlan(optimizeLogical("SELECT * FROM m WHERE __key = ?", table), plan(planRow(0, SelectByKeyMapLogicalRel.class)));
}
use of com.hazelcast.jet.sql.impl.schema.HazelcastTable in project hazelcast by hazelcast.
the class LogicalSelectTest method test_selectByKeyOrKey.
@Test
public void test_selectByKeyOrKey() {
HazelcastTable table = partitionedTable("m", asList(field(KEY, INT), field(VALUE, VARCHAR)), 10);
assertPlan(optimizeLogical("SELECT * FROM m WHERE __key = 1 OR __key = 2", table), plan(planRow(0, FullScanLogicalRel.class)));
}
use of com.hazelcast.jet.sql.impl.schema.HazelcastTable 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.jet.sql.impl.schema.HazelcastTable 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)));
}
Aggregations