Search in sources :

Example 1 with TimestampExtractionPolicy

use of io.confluent.ksql.execution.streams.timestamp.TimestampExtractionPolicy in project ksql by confluentinc.

the class SourceBuilderUtils method timestampExtractor.

static TimestampExtractor timestampExtractor(final KsqlConfig ksqlConfig, final LogicalSchema sourceSchema, final Optional<TimestampColumn> timestampColumn, final SourceStep<?> streamSource, final RuntimeBuildContext buildContext) {
    final TimestampExtractionPolicy timestampPolicy = TimestampExtractionPolicyFactory.create(ksqlConfig, sourceSchema, timestampColumn);
    final Optional<Column> tsColumn = timestampColumn.map(TimestampColumn::getColumn).map(c -> sourceSchema.findColumn(c).orElseThrow(IllegalStateException::new));
    final QueryContext queryContext = streamSource.getProperties().getQueryContext();
    return timestampPolicy.create(tsColumn, ksqlConfig.getBoolean(KsqlConfig.KSQL_TIMESTAMP_THROW_ON_INVALID), buildContext.getProcessingLogger(queryContext));
}
Also used : TimestampColumn(io.confluent.ksql.execution.timestamp.TimestampColumn) Column(io.confluent.ksql.schema.ksql.Column) TimestampExtractionPolicy(io.confluent.ksql.execution.streams.timestamp.TimestampExtractionPolicy) QueryContext(io.confluent.ksql.execution.context.QueryContext)

Aggregations

QueryContext (io.confluent.ksql.execution.context.QueryContext)1 TimestampExtractionPolicy (io.confluent.ksql.execution.streams.timestamp.TimestampExtractionPolicy)1 TimestampColumn (io.confluent.ksql.execution.timestamp.TimestampColumn)1 Column (io.confluent.ksql.schema.ksql.Column)1