use of io.confluent.ksql.serde.WindowInfo in project ksql by confluentinc.
the class SchemaKSourceFactory method buildWindowedTable.
private static SchemaKTable<?> buildWindowedTable(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 SourceStep<KTableHolder<Windowed<GenericKey>>> step = ExecutionStepFactory.tableSourceWindowed(contextStacker, dataSource.getSchema(), dataSource.getKafkaTopicName(), Formats.from(dataSource.getKsqlTopic()), windowInfo, dataSource.getTimestampColumn(), pseudoColumnVersionToUse);
return schemaKTable(buildContext, resolveSchema(buildContext, step, dataSource), dataSource.getKsqlTopic().getKeyFormat(), step);
}
use of io.confluent.ksql.serde.WindowInfo in project ksql by confluentinc.
the class KsMaterialization method windowed.
// Enforced by type
@SuppressWarnings("OptionalGetWithoutIsPresent")
@Override
public StreamsMaterializedWindowedTable windowed() {
if (!windowInfo.isPresent()) {
throw new UnsupportedOperationException("Table has non-windowed key");
}
final WindowInfo wndInfo = windowInfo.get();
final WindowType wndType = wndInfo.getType();
switch(wndType) {
case SESSION:
if (stateStore.getKsqlConfig().getBoolean(KsqlConfig.KSQL_QUERY_PULL_CONSISTENCY_OFFSET_VECTOR_ENABLED)) {
return new KsMaterializedSessionTableIQv2(stateStore);
} else {
return new KsMaterializedSessionTable(stateStore, SessionStoreCacheBypass::fetch, SessionStoreCacheBypass::fetchRange);
}
case HOPPING:
case TUMBLING:
if (stateStore.getKsqlConfig().getBoolean(KsqlConfig.KSQL_QUERY_PULL_CONSISTENCY_OFFSET_VECTOR_ENABLED)) {
return new KsMaterializedWindowTableIQv2(stateStore, wndInfo.getSize().get());
} else {
return new KsMaterializedWindowTable(stateStore, wndInfo.getSize().get(), WindowStoreCacheBypass::fetch, WindowStoreCacheBypass::fetchAll, WindowStoreCacheBypass::fetchRange);
}
default:
throw new UnsupportedOperationException("Unknown window type: " + wndInfo);
}
}
Aggregations