use of io.confluent.ksql.schema.ksql.types.SqlType in project ksql by confluentinc.
the class KsqlTypesSerdeModuleTest method shouldSerDeSqlMapTypes.
@Test
public void shouldSerDeSqlMapTypes() throws JsonProcessingException {
// Given:
final List<SqlType> types = ImmutableList.of(SqlTypes.INTEGER, SqlTypes.BIGINT, SqlTypes.DOUBLE, SqlTypes.STRING);
for (final SqlType keyType : types) {
for (final SqlType valueType : Lists.reverse(types)) {
// When:
final String serialized = MAPPER.writeValueAsString(SqlMap.of(keyType, valueType));
final SqlType out = MAPPER.readValue(serialized, SqlType.class);
// Then
assertThat(out, is(SqlMap.of(keyType, valueType)));
}
}
}
use of io.confluent.ksql.schema.ksql.types.SqlType in project ksql by confluentinc.
the class KsqlTypesSerdeModuleTest method shouldSerDeStructType.
@Test
public void shouldSerDeStructType() throws JsonProcessingException {
// Given:
SqlStruct struct = SqlStruct.builder().field("foo", SqlArray.of(SqlTypes.STRING)).build();
// When:
final SqlType out = MAPPER.readValue(MAPPER.writeValueAsString(struct), SqlType.class);
// Then:
assertThat(out, is(struct));
}
use of io.confluent.ksql.schema.ksql.types.SqlType in project ksql by confluentinc.
the class KsqlTypesSerdeModuleTest method shouldSerDeSqlPrimitiveTypes.
@Test
public void shouldSerDeSqlPrimitiveTypes() throws JsonProcessingException {
// Given:
final SqlType[] types = new SqlType[] { SqlTypes.INTEGER, SqlTypes.BIGINT, SqlTypes.DOUBLE, SqlTypes.STRING };
for (final SqlType type : types) {
// When:
final SqlType out = MAPPER.readValue(MAPPER.writeValueAsString(type), SqlType.class);
// Then
assertThat(out, is(type));
}
}
use of io.confluent.ksql.schema.ksql.types.SqlType in project ksql by confluentinc.
the class ConnectFormatSchemaTranslator method toColumn.
private static SimpleColumn toColumn(final Field field) {
final ColumnName name = ColumnName.of(field.name());
final SqlType type = SchemaConverters.connectToSqlConverter().toSqlType(field.schema());
return new ConnectColumn(name, type);
}
use of io.confluent.ksql.schema.ksql.types.SqlType in project ksql by confluentinc.
the class StepSchemaResolver method handleStreamSelectKeyV1.
private LogicalSchema handleStreamSelectKeyV1(final LogicalSchema sourceSchema, final StreamSelectKeyV1 step) {
final ExpressionTypeManager expressionTypeManager = new ExpressionTypeManager(sourceSchema, functionRegistry);
final SqlType keyType = expressionTypeManager.getExpressionSqlType(step.getKeyExpression());
return LogicalSchema.builder().keyColumn(SystemColumns.ROWKEY_NAME, keyType).valueColumns(sourceSchema.value()).build();
}
Aggregations