use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.
the class TableElementTest method shouldReturnSingleHeaderKeyConstraint.
@Test
public void shouldReturnSingleHeaderKeyConstraint() {
// Given:
final TableElement valueElement = new TableElement(NAME, new Type(SqlTypes.STRING), HEADER_SINGLE_KEY_CONSTRAINT);
// Then:
assertThat(valueElement.getConstraints(), is(HEADER_SINGLE_KEY_CONSTRAINT));
}
use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.
the class TableElementTest method shouldReturnPrimaryKey.
@Test
public void shouldReturnPrimaryKey() {
// Given:
final TableElement valueElement = new TableElement(NAME, new Type(SqlTypes.STRING), PRIMARY_KEY_CONSTRAINT);
// Then:
assertThat(valueElement.getConstraints(), is(PRIMARY_KEY_CONSTRAINT));
}
use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.
the class SqlTypeParserTest method shouldGetTypeFromStructWithTwoFields.
@Test
public void shouldGetTypeFromStructWithTwoFields() {
// Given:
final String schemaString = "STRUCT<A VARCHAR, B INT>";
// When:
final Type type = parser.parse(schemaString);
// Then:
assertThat(type, is(new Type(SqlStruct.builder().field("A", SqlTypes.STRING).field("B", SqlTypes.INTEGER).build())));
}
use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.
the class SqlTypeParserTest method shouldReturnCustomTypeOnUnknownTypeName.
@Test
public void shouldReturnCustomTypeOnUnknownTypeName() {
// Given:
final String schemaString = "SHAKESPEARE";
when(typeRegistry.resolveType(schemaString)).thenReturn(Optional.of(SqlTypes.STRING));
// When:
final Type type = parser.parse(schemaString);
// Then:
assertThat(type.getSqlType(), is(SqlTypes.STRING));
}
use of io.confluent.ksql.execution.expression.tree.Type in project ksql by confluentinc.
the class SqlTypeParserTest method shouldGetTypeFromEmptyStruct.
@Test
public void shouldGetTypeFromEmptyStruct() {
// Given:
final String schemaString = SqlTypes.struct().build().toString();
// When:
final Type type = parser.parse(schemaString);
// Then:
assertThat(type, is(new Type(SqlTypes.struct().build())));
}
Aggregations