Search in sources :

Example 1 with WindowedStreamSource

use of io.confluent.ksql.execution.plan.WindowedStreamSource in project ksql by confluentinc.

the class StepSchemaResolverTest method shouldResolveSchemaForStreamWindowedSource.

@Test
public void shouldResolveSchemaForStreamWindowedSource() {
    final WindowedStreamSource step = new WindowedStreamSource(PROPERTIES, "foo", formats, WindowInfo.of(WindowType.TUMBLING, Optional.of(Duration.ofMillis(123))), Optional.empty(), SCHEMA, OptionalInt.of(SystemColumns.CURRENT_PSEUDOCOLUMN_VERSION_NUMBER));
    // When:
    final LogicalSchema result = resolver.resolve(step, SCHEMA);
    // Then:
    assertThat(result, is(SCHEMA.withPseudoAndKeyColsInValue(true)));
}
Also used : LogicalSchema(io.confluent.ksql.schema.ksql.LogicalSchema) WindowedStreamSource(io.confluent.ksql.execution.plan.WindowedStreamSource) Test(org.junit.Test)

Example 2 with WindowedStreamSource

use of io.confluent.ksql.execution.plan.WindowedStreamSource in project ksql by confluentinc.

the class SourceBuilderV1Test method givenWindowedSourceStream.

private void givenWindowedSourceStream(final int pseudoColumnVersion) {
    when(buildContext.buildKeySerde(any(), any(), any(), any())).thenReturn(windowedKeySerde);
    givenConsumed(consumedWindowed, windowedKeySerde);
    windowedStreamSource = new WindowedStreamSource(new ExecutionStepPropertiesV1(ctx), TOPIC_NAME, Formats.of(keyFormatInfo, valueFormatInfo, KEY_FEATURES, VALUE_FEATURES), windowInfo, TIMESTAMP_COLUMN, SOURCE_SCHEMA, OptionalInt.of(pseudoColumnVersion));
}
Also used : ExecutionStepPropertiesV1(io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1) WindowedStreamSource(io.confluent.ksql.execution.plan.WindowedStreamSource)

Example 3 with WindowedStreamSource

use of io.confluent.ksql.execution.plan.WindowedStreamSource in project ksql by confluentinc.

the class SchemaKSourceFactory method buildWindowedStream.

private static SchemaKStream<?> buildWindowedStream(final PlanBuildContext buildContext, final DataSource dataSource, final Stacker contextStacker) {
    final WindowInfo windowInfo = dataSource.getKsqlTopic().getKeyFormat().getWindowInfo().orElseThrow(IllegalArgumentException::new);
    final int pseudoColumnVersionToUse = determinePseudoColumnVersionToUse(buildContext);
    final WindowedStreamSource step = ExecutionStepFactory.streamSourceWindowed(contextStacker, dataSource.getSchema(), dataSource.getKafkaTopicName(), Formats.from(dataSource.getKsqlTopic()), windowInfo, dataSource.getTimestampColumn(), pseudoColumnVersionToUse);
    return schemaKStream(buildContext, resolveSchema(buildContext, step, dataSource), dataSource.getKsqlTopic().getKeyFormat(), step);
}
Also used : WindowedStreamSource(io.confluent.ksql.execution.plan.WindowedStreamSource) WindowInfo(io.confluent.ksql.serde.WindowInfo)

Aggregations

WindowedStreamSource (io.confluent.ksql.execution.plan.WindowedStreamSource)3 ExecutionStepPropertiesV1 (io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1)1 LogicalSchema (io.confluent.ksql.schema.ksql.LogicalSchema)1 WindowInfo (io.confluent.ksql.serde.WindowInfo)1 Test (org.junit.Test)1