use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.
the class SqlTypeParserTest method shouldGetTypeFromIntArray.
@Test
public void shouldGetTypeFromIntArray() {
// Given:
final String schemaString = "ARRAY<INT>";
// When:
final Type type = parser.parse(schemaString);
// Then:
assertThat(type, is(new Type(SqlTypes.array(SqlTypes.INTEGER))));
}
use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.
the class CommandFactoriesTest method shouldCreateCommandForCreateTable.
@Test
public void shouldCreateCommandForCreateTable() {
// Given:
final CreateTable statement = new CreateTable(SOME_NAME, TableElements.of(tableElement("COL1", new Type(SqlTypes.BIGINT)), tableElement("COL2", new Type(SqlTypes.STRING))), false, true, withProperties, false);
// When:
final DdlCommand result = commandFactories.create(sqlExpression, statement, SessionConfig.of(ksqlConfig, emptyMap()));
// Then:
assertThat(result, is(createTableCommand));
verify(createSourceFactory).createTableCommand(statement, ksqlConfig);
}
use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.
the class CommandFactoriesTest method shouldCreateCommandForCreateTableWithOverriddenProperties.
@Test
public void shouldCreateCommandForCreateTableWithOverriddenProperties() {
// Given:
final CreateTable statement = new CreateTable(SOME_NAME, TableElements.of(tableElement("COL1", new Type(SqlTypes.BIGINT)), tableElement("COL2", new Type(SqlTypes.STRING))), false, true, withProperties, false);
// When:
commandFactories.create(sqlExpression, statement, SessionConfig.of(ksqlConfig, OVERRIDES));
// Then:
verify(createSourceFactory).createTableCommand(statement, ksqlConfig.cloneWithPropertyOverwrite(OVERRIDES));
}
use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.
the class SchemaParserTest method shouldParseQuotedSchema.
@Test
public void shouldParseQuotedSchema() {
// Given:
final String schema = "`END` VARCHAR";
// When:
final TableElements elements = parser.parse(schema);
// Then:
assertThat(elements, hasItem(new TableElement(ColumnName.of("END"), new Type(SqlTypes.STRING))));
}
use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.
the class SchemaParserTest method shouldParseValidSchemaWithPrimaryKeyField.
@Test
public void shouldParseValidSchemaWithPrimaryKeyField() {
// Given:
final String schema = "K STRING PRIMARY KEY, bar INT";
// When:
final TableElements elements = parser.parse(schema);
// Then:
assertThat(elements, contains(new TableElement(ColumnName.of("K"), new Type(SqlTypes.STRING), PRIMARY_KEY_CONSTRAINT), new TableElement(BAR, new Type(SqlTypes.INTEGER))));
}
Aggregations