Search in sources :

Example 1 with NewTopic

use of io.confluent.ksql.analyzer.Analysis.Into.NewTopic in project ksql by confluentinc.

the class LogicalPlanner method getSinkTopic.

private KsqlTopic getSinkTopic(final Into into, final LogicalSchema schema) {
    if (into.getExistingTopic().isPresent()) {
        return into.getExistingTopic().get();
    }
    final NewTopic newTopic = into.getNewTopic().orElseThrow(IllegalStateException::new);
    final FormatInfo keyFormat = getSinkKeyFormat(schema, newTopic);
    final SerdeFeatures keyFeatures = SerdeFeaturesFactory.buildKeyFeatures(schema, FormatFactory.of(keyFormat));
    final SerdeFeatures valFeatures = SerdeFeaturesFactory.buildValueFeatures(schema, FormatFactory.of(newTopic.getValueFormat()), analysis.getProperties().getValueSerdeFeatures(), ksqlConfig);
    return new KsqlTopic(newTopic.getTopicName(), KeyFormat.of(keyFormat, keyFeatures, newTopic.getWindowInfo()), ValueFormat.of(newTopic.getValueFormat(), valFeatures));
}
Also used : NewTopic(io.confluent.ksql.analyzer.Analysis.Into.NewTopic) FormatInfo(io.confluent.ksql.serde.FormatInfo) SerdeFeatures(io.confluent.ksql.serde.SerdeFeatures) KsqlTopic(io.confluent.ksql.execution.ddl.commands.KsqlTopic)

Aggregations

NewTopic (io.confluent.ksql.analyzer.Analysis.Into.NewTopic)1 KsqlTopic (io.confluent.ksql.execution.ddl.commands.KsqlTopic)1 FormatInfo (io.confluent.ksql.serde.FormatInfo)1 SerdeFeatures (io.confluent.ksql.serde.SerdeFeatures)1