use of com.hazelcast.jet.sql.impl.SqlPlanImpl.CreateMappingPlan in project hazelcast by hazelcast.
the class PlanExecutorTest method test_createMappingExecution.
@Test
@Parameters({ "true, false", "false, true" })
public void test_createMappingExecution(boolean replace, boolean ifNotExists) {
// given
Mapping mapping = mapping();
CreateMappingPlan plan = new CreateMappingPlan(planKey(), mapping, replace, ifNotExists, planExecutor);
// when
SqlResult result = planExecutor.execute(plan);
// then
assertThat(result.updateCount()).isEqualTo(0);
verify(catalog).createMapping(mapping, replace, ifNotExists);
}
use of com.hazelcast.jet.sql.impl.SqlPlanImpl.CreateMappingPlan in project hazelcast by hazelcast.
the class CalciteSqlOptimizer method toCreateMappingPlan.
private SqlPlan toCreateMappingPlan(PlanKey planKey, SqlCreateMapping sqlCreateMapping) {
List<MappingField> mappingFields = sqlCreateMapping.columns().map(field -> new MappingField(field.name(), field.type(), field.externalName())).collect(toList());
Mapping mapping = new Mapping(sqlCreateMapping.nameWithoutSchema(), sqlCreateMapping.externalName(), sqlCreateMapping.type(), mappingFields, sqlCreateMapping.options());
return new CreateMappingPlan(planKey, mapping, sqlCreateMapping.getReplace(), sqlCreateMapping.ifNotExists(), planExecutor);
}
Aggregations