use of com.hazelcast.jet.sql.impl.schema.HazelcastTable in project hazelcast by hazelcast.
the class LogicalSelectTest method test_selectByKeyWithProjectExpression.
@Test
public void test_selectByKeyWithProjectExpression() {
HazelcastTable table = partitionedTable("m", asList(field(KEY, INT), field(VALUE, VARCHAR)), 1);
assertPlan(optimizeLogical("SELECT this || '-s' FROM m WHERE __key = 1", table), plan(planRow(0, SelectByKeyMapLogicalRel.class)));
}
use of com.hazelcast.jet.sql.impl.schema.HazelcastTable in project hazelcast by hazelcast.
the class LogicalStreamAggTest method test.
@Test
public void test() {
HazelcastTable table = partitionedTable("map", asList(field(KEY, INT), field(VALUE, INT)), 1);
List<QueryDataType> parameterTypes = asList(QueryDataType.INT, QueryDataType.INT);
final String sql = "SELECT window_start, window_end, SUM(__key) FROM " + "TABLE(HOP(" + " (SELECT * FROM TABLE(IMPOSE_ORDER((SELECT __key, this FROM map), DESCRIPTOR(__key), 1))), " + "DESCRIPTOR(__key), 2, 1)) " + "GROUP BY window_start, window_end, __key, this";
assertPlan(optimizePhysical(sql, parameterTypes, table).getPhysical(), plan(planRow(0, ProjectPhysicalRel.class), planRow(1, AggregateCombineByKeyPhysicalRel.class), planRow(2, AggregateAccumulateByKeyPhysicalRel.class), planRow(3, ProjectPhysicalRel.class), planRow(4, SlidingWindowPhysicalRel.class), planRow(5, FullScanPhysicalRel.class)));
}
use of com.hazelcast.jet.sql.impl.schema.HazelcastTable in project hazelcast by hazelcast.
the class PhysicalJoinTest method when_isSimpleJoin_then_useNestedLoopJoin.
@Test
public void when_isSimpleJoin_then_useNestedLoopJoin() {
HazelcastTable tableLeft = partitionedTable("l", asList(field(KEY, INT), field(VALUE, INT)), 1);
HazelcastTable tableRight = partitionedTable("r", asList(field(KEY, INT), field(VALUE, INT)), 1);
String query = "SELECT * FROM l JOIN r ON l.__key = r.__key";
assertPlan(optimizePhysical(query, asList(INT, INT, INT, INT), tableLeft, tableRight).getPhysical(), plan(planRow(0, JoinNestedLoopPhysicalRel.class), planRow(1, FullScanPhysicalRel.class), planRow(1, FullScanPhysicalRel.class)));
}
use of com.hazelcast.jet.sql.impl.schema.HazelcastTable in project hazelcast by hazelcast.
the class SqlNoSerializationTest method checkIndexUsage.
private void checkIndexUsage(SqlStatement statement, boolean expectedIndexUsage) {
List<QueryDataType> parameterTypes = asList(QueryDataType.INT, QueryDataType.OBJECT, QueryDataType.INT);
List<TableField> mapTableFields = asList(new MapTableField("__key", QueryDataType.INT, false, QueryPath.KEY_PATH), new MapTableField("this", QueryDataType.OBJECT, false, QueryPath.VALUE_PATH), new MapTableField("val", QueryDataType.INT, false, new QueryPath("val", false)));
HazelcastTable table = partitionedTable(MAP_NAME, mapTableFields, getPartitionedMapIndexes(mapContainer(instance().getMap(MAP_NAME)), mapTableFields), KEY_COUNT);
OptimizerTestSupport.Result optimizationResult = optimizePhysical(statement.getSql(), parameterTypes, table);
assertPlan(optimizationResult.getLogical(), plan(planRow(0, FullScanLogicalRel.class)));
if (expectedIndexUsage) {
assertPlan(optimizationResult.getPhysical(), plan(planRow(0, IndexScanMapPhysicalRel.class)));
} else {
assertPlan(optimizationResult.getPhysical(), plan(planRow(0, FullScanPhysicalRel.class)));
}
}
use of com.hazelcast.jet.sql.impl.schema.HazelcastTable in project hazelcast by hazelcast.
the class LogicalDeleteTest method test_deleteByKeyWithLiteralExpression.
@Test
public void test_deleteByKeyWithLiteralExpression() {
HazelcastTable table = partitionedTable("m", asList(field(KEY, INT), field(VALUE, VARCHAR)), 1);
assertPlan(optimizeLogical("DELETE FROM m WHERE __key = 1 + 1", table), plan(planRow(0, DeleteByKeyMapLogicalRel.class)));
}
Aggregations