Search in sources :

Example 1 with KsqlVoidSerde

use of io.confluent.ksql.serde.voids.KsqlVoidSerde in project ksql by confluentinc.

the class KafkaSerdeFactory method createSerde.

static Serde<List<?>> createSerde(final PersistenceSchema schema) {
    final List<SimpleColumn> columns = schema.columns();
    if (columns.isEmpty()) {
        // No columns:
        return new KsqlVoidSerde<>();
    }
    if (columns.size() != 1) {
        throw new KsqlException("The '" + FormatFactory.KAFKA.name() + "' format only supports a single field. Got: " + columns);
    }
    final SimpleColumn singleColumn = columns.get(0);
    final Class<?> javaType = SchemaConverters.sqlToJavaConverter().toJavaType(singleColumn.type());
    return createSerde(singleColumn, javaType);
}
Also used : KsqlVoidSerde(io.confluent.ksql.serde.voids.KsqlVoidSerde) SimpleColumn(io.confluent.ksql.schema.ksql.SimpleColumn) KsqlException(io.confluent.ksql.util.KsqlException)

Aggregations

SimpleColumn (io.confluent.ksql.schema.ksql.SimpleColumn)1 KsqlVoidSerde (io.confluent.ksql.serde.voids.KsqlVoidSerde)1 KsqlException (io.confluent.ksql.util.KsqlException)1