use of io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1 in project ksql by confluentinc.
the class StreamFilterBuilderTest method init.
@Before
@SuppressWarnings({ "unchecked", "rawtypes" })
public void init() {
when(buildContext.getKsqlConfig()).thenReturn(ksqlConfig);
when(buildContext.getFunctionRegistry()).thenReturn(functionRegistry);
when(buildContext.getProcessingLogger(any())).thenReturn(processingLogger);
when(sourceStep.getProperties()).thenReturn(sourceProperties);
when(sourceKStream.flatTransformValues(any(ValueTransformerWithKeySupplier.class), any(Named.class))).thenReturn(filteredKStream);
when(predicateFactory.create(any(), any(), any(), any())).thenReturn(sqlPredicate);
when(sqlPredicate.getTransformer(any())).thenReturn((KsqlTransformer) predicate);
when(sourceStep.build(any(), eq(planInfo))).thenReturn(new KStreamHolder<>(sourceKStream, schema, executionKeyFactory));
final ExecutionStepPropertiesV1 properties = new ExecutionStepPropertiesV1(queryContext);
planBuilder = new KSPlanBuilder(buildContext, predicateFactory, mock(AggregateParamsFactory.class), mock(StreamsFactories.class));
step = new StreamFilter<>(properties, sourceStep, filterExpression);
}
use of io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1 in project ksql by confluentinc.
the class SourceBuilderV1Test method givenUnwindowedSourceTableV1.
private void givenUnwindowedSourceTableV1(final Boolean forceChangelog, final int pseudoColumnVersion) {
when(buildContext.buildKeySerde(any(), any(), any())).thenReturn(keySerde);
givenConsumed(consumed, keySerde);
tableSourceV1 = new TableSourceV1(new ExecutionStepPropertiesV1(ctx), TOPIC_NAME, Formats.of(keyFormatInfo, valueFormatInfo, KEY_FEATURES, VALUE_FEATURES), TIMESTAMP_COLUMN, SOURCE_SCHEMA, Optional.of(forceChangelog), OptionalInt.of(pseudoColumnVersion));
}
use of io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1 in project ksql by confluentinc.
the class StreamAggregateBuilderTest method givenSessionWindowedAggregate.
@SuppressWarnings({ "unchecked", "rawtypes" })
private void givenSessionWindowedAggregate() {
when(materializedFactory.<GenericKey, SessionStore<Bytes, byte[]>>create(any(), any(), any(), any())).thenReturn(sessionWindowMaterialized);
when(groupedStream.windowedBy(any(SessionWindows.class))).thenReturn(sessionWindowedStream);
when(sessionWindowedStream.aggregate(any(), any(), any(), any(Materialized.class))).thenReturn(windowed);
when(windowed.transformValues(any(), any(Named.class))).thenReturn((KTable) windowedWithResults);
when(windowedWithResults.transformValues(any(), any(Named.class))).thenReturn((KTable) windowedWithWindowBounds);
windowedAggregate = new StreamWindowedAggregate(new ExecutionStepPropertiesV1(CTX), sourceStep, Formats.of(KEY_FORMAT, VALUE_FORMAT, SerdeFeatures.of(), SerdeFeatures.of()), NON_AGG_COLUMNS, FUNCTIONS, new SessionWindowExpression(Optional.empty(), new WindowTimeClause(WINDOW.getSeconds(), TimeUnit.SECONDS), Optional.of(retentionClause), Optional.of(gracePeriodClause)));
}
use of io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1 in project ksql by confluentinc.
the class TableFilterBuilderTest method init.
@Before
@SuppressWarnings({ "unchecked", "rawtypes" })
public void init() {
when(buildContext.getKsqlConfig()).thenReturn(ksqlConfig);
when(buildContext.getFunctionRegistry()).thenReturn(functionRegistry);
when(buildContext.getProcessingLogger(any())).thenReturn(processingLogger);
when(sourceStep.getProperties()).thenReturn(sourceProperties);
when(sourceKTable.transformValues(any(), any(Named.class))).thenReturn((KTable) preKTable);
when(preKTable.filter(any(), any(Named.class))).thenReturn(filteredKTable);
when(filteredKTable.mapValues(any(ValueMapper.class), any(Named.class))).thenReturn(postKTable);
when(predicateFactory.create(any(), any(), any(), any())).thenReturn(sqlPredicate);
when(sqlPredicate.getTransformer(any())).thenReturn((KsqlTransformer) preTransformer);
when(materializationBuilder.filter(any(), any())).thenReturn(materializationBuilder);
final ExecutionStepPropertiesV1 properties = new ExecutionStepPropertiesV1(queryContext);
step = new TableFilter<>(properties, sourceStep, filterExpression);
when(sourceStep.build(any(), eq(planInfo))).thenReturn(KTableHolder.materialized(sourceKTable, schema, executionKeyFactory, materializationBuilder));
when(preTransformer.transform(any(), any(), any())).thenReturn(Optional.empty());
planBuilder = new KSPlanBuilder(buildContext, predicateFactory, mock(AggregateParamsFactory.class), mock(StreamsFactories.class));
}
use of io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1 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));
}
Aggregations