use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.
the class ExpressionFormatterTest method shouldFormatStructWithColumnWithReservedWordName.
@Test
public void shouldFormatStructWithColumnWithReservedWordName() {
final SqlStruct struct = SqlStruct.builder().field("RESERVED", SqlTypes.INTEGER).build();
assertThat(ExpressionFormatter.formatExpression(new Type(struct), FormatOptions.none()), equalTo("STRUCT<`RESERVED` INTEGER>"));
}
use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.
the class SqlTypeParser method getType.
public Type getType(final SqlBaseParser.TypeContext type) {
final Optional<NodeLocation> location = ParserUtil.getLocation(type);
final SqlType sqlType = getSqlType(type);
return new Type(location, sqlType);
}
use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.
the class ExpressionTreeRewriterTest method shouldRewriteType.
@Test
public void shouldRewriteType() {
// Given:
final Type type = new Type(SqlPrimitiveType.of("INTEGER"));
// When:
final Expression rewritten = expressionRewriter.rewrite(type, context);
// Then:
assertThat(rewritten, is(type));
}
use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.
the class CreateSourceFactoryTest method shouldThrowInCreateTableOrReplaceSource.
@Test
public void shouldThrowInCreateTableOrReplaceSource() {
// Given:
final CreateTable ddlStatement = new CreateTable(TABLE_NAME, TableElements.of(tableElement("COL1", new Type(BIGINT), PRIMARY_KEY_CONSTRAINT), tableElement("COL2", new Type(SqlTypes.STRING))), true, false, withProperties, true);
// When:
final Exception e = assertThrows(KsqlException.class, () -> createSourceFactory.createTableCommand(ddlStatement, ksqlConfig));
// Then:
assertThat(e.getMessage(), containsString("Cannot add table 'table_bob': CREATE OR REPLACE is not supported on " + "source tables."));
}
use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.
the class CreateSourceFactoryTest method shouldThrowOnWindowEndValueColumn.
@Test
public void shouldThrowOnWindowEndValueColumn() {
// Given:
final CreateStream statement = new CreateStream(SOME_NAME, TableElements.of(tableElement(WINDOWEND_NAME.text(), new Type(BIGINT))), false, true, withProperties, false);
// When:
final Exception e = assertThrows(KsqlException.class, () -> createSourceFactory.createStreamCommand(statement, ksqlConfig));
// Then:
assertThat(e.getMessage(), containsString("'WINDOWEND' is a reserved column name."));
}
Aggregations