use of io.confluent.ksql.execution.plan.WindowedTableSource in project ksql by confluentinc.
the class SourceBuilderV1Test method givenWindowedSourceTable.
private void givenWindowedSourceTable(final int pseudoColumnVersion) {
when(buildContext.buildKeySerde(any(), any(), any(), any())).thenReturn(windowedKeySerde);
givenConsumed(consumedWindowed, windowedKeySerde);
givenConsumed(consumedWindowed, windowedKeySerde);
windowedTableSource = new WindowedTableSource(new ExecutionStepPropertiesV1(ctx), TOPIC_NAME, Formats.of(keyFormatInfo, valueFormatInfo, KEY_FEATURES, VALUE_FEATURES), windowInfo, TIMESTAMP_COLUMN, SOURCE_SCHEMA, OptionalInt.of(pseudoColumnVersion));
}
use of io.confluent.ksql.execution.plan.WindowedTableSource in project ksql by confluentinc.
the class SourceBuilderV1 method buildWindowedTable.
KTableHolder<Windowed<GenericKey>> buildWindowedTable(final RuntimeBuildContext buildContext, final SourceStep<KTableHolder<Windowed<GenericKey>>> source, final ConsumedFactory consumedFactory, final MaterializedFactory materializedFactory, final PlanInfo planInfo) {
final PhysicalSchema physicalSchema = getPhysicalSchema(source);
final Serde<GenericRow> valueSerde = getValueSerde(buildContext, source, physicalSchema);
final WindowInfo windowInfo;
if (source instanceof WindowedTableSource) {
windowInfo = ((WindowedTableSource) source).getWindowInfo();
} else {
throw new IllegalArgumentException("Expected a version of WindowedTableSource");
}
final Serde<Windowed<GenericKey>> keySerde = SourceBuilderUtils.getWindowedKeySerde(source, physicalSchema, buildContext, windowInfo);
final Consumed<Windowed<GenericKey>, GenericRow> consumed = buildSourceConsumed(source, keySerde, valueSerde, AutoOffsetReset.EARLIEST, buildContext, consumedFactory);
final String stateStoreName = tableChangeLogOpName(source.getProperties());
final Materialized<Windowed<GenericKey>, GenericRow, KeyValueStore<Bytes, byte[]>> materialized = materializedFactory.create(keySerde, valueSerde, stateStoreName);
final KTable<Windowed<GenericKey>, GenericRow> ktable = buildKTable(source, buildContext, consumed, windowedKeyGenerator(source.getSourceSchema()), materialized, valueSerde, stateStoreName, planInfo);
return KTableHolder.materialized(ktable, buildSchema(source, true), ExecutionKeyFactory.windowed(buildContext, windowInfo), MaterializationInfo.builder(stateStoreName, physicalSchema.logicalSchema()));
}
use of io.confluent.ksql.execution.plan.WindowedTableSource in project ksql by confluentinc.
the class StepSchemaResolverTest method shouldResolveSchemaForWindowedTableSource.
@Test
public void shouldResolveSchemaForWindowedTableSource() {
// Given:
final WindowedTableSource step = new WindowedTableSource(PROPERTIES, "foo", formats, mock(WindowInfo.class), 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)));
}
Aggregations