use of io.confluent.ksql.parser.tree.RegisterType in project ksql by confluentinc.
the class RegisterTypeFactoryTest method shouldNotThrowOnRegisterExistingTypeWhenIfNotExistsSet.
@Test
public void shouldNotThrowOnRegisterExistingTypeWhenIfNotExistsSet() {
// Given:
final RegisterType ddlStatement = new RegisterType(Optional.empty(), EXISTING_TYPE, new Type(SqlStruct.builder().field("foo", SqlPrimitiveType.of(SqlBaseType.STRING)).build()), true);
// When:
final RegisterTypeCommand result = factory.create(ddlStatement);
// Then:
assertThat(result.getType(), equalTo(ddlStatement.getType().getSqlType()));
assertThat(result.getTypeName(), equalTo(EXISTING_TYPE));
}
use of io.confluent.ksql.parser.tree.RegisterType in project ksql by confluentinc.
the class TestCaseBuilderUtil method registerType.
private static void registerType(final PreparedStatement<?> prepare, final MetaStore metaStore) {
if (prepare.getStatement() instanceof RegisterType) {
final RegisterType statement = (RegisterType) prepare.getStatement();
metaStore.registerType(statement.getName(), statement.getType().getSqlType());
}
}
Aggregations