Search in sources :

Example 1 with ExecutionStepPropertiesV1

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);
}
Also used : Named(org.apache.kafka.streams.kstream.Named) ExecutionStepPropertiesV1(io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1) ValueTransformerWithKeySupplier(org.apache.kafka.streams.kstream.ValueTransformerWithKeySupplier) Before(org.junit.Before)

Example 2 with ExecutionStepPropertiesV1

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));
}
Also used : TableSourceV1(io.confluent.ksql.execution.plan.TableSourceV1) ExecutionStepPropertiesV1(io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1)

Example 3 with ExecutionStepPropertiesV1

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)));
}
Also used : SessionStore(org.apache.kafka.streams.state.SessionStore) Named(org.apache.kafka.streams.kstream.Named) SessionWindows(org.apache.kafka.streams.kstream.SessionWindows) ExecutionStepPropertiesV1(io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1) StreamWindowedAggregate(io.confluent.ksql.execution.plan.StreamWindowedAggregate) WindowTimeClause(io.confluent.ksql.execution.windows.WindowTimeClause) GenericKey(io.confluent.ksql.GenericKey) Materialized(org.apache.kafka.streams.kstream.Materialized) SessionWindowExpression(io.confluent.ksql.execution.windows.SessionWindowExpression)

Example 4 with ExecutionStepPropertiesV1

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));
}
Also used : Named(org.apache.kafka.streams.kstream.Named) ValueMapper(org.apache.kafka.streams.kstream.ValueMapper) ExecutionStepPropertiesV1(io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1) Before(org.junit.Before)

Example 5 with ExecutionStepPropertiesV1

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));
}
Also used : ExecutionStepPropertiesV1(io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1) WindowedStreamSource(io.confluent.ksql.execution.plan.WindowedStreamSource)

Aggregations

ExecutionStepPropertiesV1 (io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1)18 Before (org.junit.Before)6 Named (org.apache.kafka.streams.kstream.Named)5 Materialized (org.apache.kafka.streams.kstream.Materialized)4 GenericKey (io.confluent.ksql.GenericKey)3 StreamSource (io.confluent.ksql.execution.plan.StreamSource)3 StreamWindowedAggregate (io.confluent.ksql.execution.plan.StreamWindowedAggregate)3 TableSource (io.confluent.ksql.execution.plan.TableSource)3 WindowedStreamSource (io.confluent.ksql.execution.plan.WindowedStreamSource)3 WindowTimeClause (io.confluent.ksql.execution.windows.WindowTimeClause)3 KeyValueStore (org.apache.kafka.streams.state.KeyValueStore)2 QueryContext (io.confluent.ksql.execution.context.QueryContext)1 PlanInfoExtractor (io.confluent.ksql.execution.plan.PlanInfoExtractor)1 StreamAggregate (io.confluent.ksql.execution.plan.StreamAggregate)1 StreamSelectKeyV1 (io.confluent.ksql.execution.plan.StreamSelectKeyV1)1 TableAggregate (io.confluent.ksql.execution.plan.TableAggregate)1 TableSourceV1 (io.confluent.ksql.execution.plan.TableSourceV1)1 WindowedTableSource (io.confluent.ksql.execution.plan.WindowedTableSource)1 HoppingWindowExpression (io.confluent.ksql.execution.windows.HoppingWindowExpression)1 SessionWindowExpression (io.confluent.ksql.execution.windows.SessionWindowExpression)1