use of com.hazelcast.jet.sql.impl.schema.HazelcastTable 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.jet.sql.impl.schema.HazelcastTable in project hazelcast by hazelcast.
the class SqlIndexResolutionTest method checkIndexUsage.
private void checkIndexUsage(SqlStatement statement, String mapName, Usage 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("field1", type1.getFieldConverterType(), false, new QueryPath("field1", false)), new MapTableField("field2", type2.getFieldConverterType(), false, new QueryPath("field2", false)));
HazelcastTable table = partitionedTable(mapName, mapTableFields, getPartitionedMapIndexes(mapContainer(instance().getMap(mapName)), mapTableFields), // we can place random number, doesn't matter in current case.
1);
OptimizerTestSupport.Result optimizationResult = optimizePhysical(statement.getSql(), parameterTypes, table);
assertPlan(optimizationResult.getLogical(), plan(planRow(0, FullScanLogicalRel.class)));
switch(expectedIndexUsage) {
case NONE:
assertPlan(optimizationResult.getPhysical(), plan(planRow(0, FullScanPhysicalRel.class)));
break;
case ONE:
assertPlan(optimizationResult.getPhysical(), plan(planRow(0, IndexScanMapPhysicalRel.class)));
assertNotNull(((IndexScanMapPhysicalRel) optimizationResult.getPhysical()).getRemainderExp());
break;
case BOTH:
assertPlan(optimizationResult.getPhysical(), plan(planRow(0, IndexScanMapPhysicalRel.class)));
assertNull(((IndexScanMapPhysicalRel) optimizationResult.getPhysical()).getRemainderExp());
break;
}
}
use of com.hazelcast.jet.sql.impl.schema.HazelcastTable in project hazelcast by hazelcast.
the class SqlSecurityCallbackTest method checkIndexUsage.
private void checkIndexUsage(String sql, boolean expectedIndexUsage) {
List<QueryDataType> parameterTypes = asList(QueryDataType.INT, QueryDataType.INT);
List<TableField> mapTableFields = asList(new MapTableField("__key", QueryDataType.INT, false, QueryPath.KEY_PATH), new MapTableField("this", QueryDataType.INT, false, QueryPath.VALUE_PATH));
HazelcastTable table = partitionedTable(mapName, mapTableFields, getPartitionedMapIndexes(mapContainer(instance().getMap(mapName)), mapTableFields), mapSize);
OptimizerTestSupport.Result optimizationResult = optimizePhysical(sql, 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.jet.sql.impl.schema.HazelcastTable in project hazelcast by hazelcast.
the class LogicalSelectTest method test_selectWithoutWhere.
@Test
public void test_selectWithoutWhere() {
HazelcastTable table = partitionedTable("m", asList(field(KEY, INT), field(VALUE, VARCHAR)), 10);
assertPlan(optimizeLogical("SELECT * FROM m", table), plan(planRow(0, FullScanLogicalRel.class)));
}
use of com.hazelcast.jet.sql.impl.schema.HazelcastTable in project hazelcast by hazelcast.
the class LogicalSelectTest method test_requiresJob.
@Test
public void test_requiresJob() {
HazelcastTable table = partitionedTable("m", asList(field(KEY, INT), field(VALUE, VARCHAR)), 0);
assertPlan(optimizeLogical("SELECT * FROM m WHERE __key = 1", true, table), plan(planRow(0, FullScanLogicalRel.class)));
assertPlan(optimizeLogical("SELECT this || '-s' FROM m WHERE __key = 1", true, table), plan(planRow(0, FullScanLogicalRel.class)));
}
Aggregations