use of io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1 in project ksql by confluentinc.
the class StreamSelectKeyBuilderV1Test method init.
@Before
@SuppressWarnings({ "unchecked", "rawtypes" })
public void init() {
when(buildContext.getFunctionRegistry()).thenReturn(functionRegistry);
when(buildContext.getKsqlConfig()).thenReturn(new KsqlConfig(ImmutableMap.of()));
when(kstream.filter(any())).thenReturn(filteredKStream);
when(filteredKStream.selectKey(any(KeyValueMapper.class))).thenReturn(rekeyedKstream);
when(sourceStep.build(any(), eq(planInfo))).thenReturn(new KStreamHolder<>(kstream, SOURCE_SCHEMA, mock(ExecutionKeyFactory.class)));
planBuilder = new KSPlanBuilder(buildContext, mock(SqlPredicateFactory.class), mock(AggregateParamsFactory.class), mock(StreamsFactories.class));
selectKey = new StreamSelectKeyV1(new ExecutionStepPropertiesV1(queryContext), sourceStep, KEY);
}
use of io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1 in project ksql by confluentinc.
the class TableAggregateBuilderTest method init.
@Before
@SuppressWarnings({ "unchecked", "rawtypes" })
public void init() {
when(buildContext.buildKeySerde(any(), any(), any())).thenReturn(keySerde);
when(buildContext.buildValueSerde(any(), any(), any())).thenReturn(valueSerde);
when(buildContext.getFunctionRegistry()).thenReturn(functionRegistry);
when(buildContext.getKsqlConfig()).thenReturn(KsqlConfig.empty());
when(aggregateParamsFactory.createUndoable(any(), any(), any(), any(), any())).thenReturn(aggregateParams);
when(aggregateParams.getAggregator()).thenReturn((KudafAggregator) aggregator);
when(aggregateParams.getUndoAggregator()).thenReturn(Optional.of(undoAggregator));
when(aggregateParams.getInitializer()).thenReturn(initializer);
when(aggregateParams.getAggregateSchema()).thenReturn(AGGREGATE_SCHEMA);
when(aggregateParams.getSchema()).thenReturn(AGGREGATE_SCHEMA);
when(aggregator.getResultMapper()).thenReturn(resultMapper);
when(materializedFactory.<GenericKey, KeyValueStore<Bytes, byte[]>>create(any(), any(), any())).thenReturn(materialized);
when(groupedTable.aggregate(any(), any(), any(), any(Materialized.class))).thenReturn(aggregated);
when(aggregated.transformValues(any(), any(Named.class))).thenReturn((KTable) aggregatedWithResults);
aggregate = new TableAggregate(new ExecutionStepPropertiesV1(CTX), sourceStep, Formats.of(KEY_FORMAT, VALUE_FORMAT, SerdeFeatures.of(), SerdeFeatures.of()), NON_AGG_COLUMNS, FUNCTIONS);
when(sourceStep.build(any(), eq(planInfo))).thenReturn(KGroupedTableHolder.of(groupedTable, INPUT_SCHEMA));
planBuilder = new KSPlanBuilder(buildContext, mock(SqlPredicateFactory.class), aggregateParamsFactory, new StreamsFactories(mock(GroupedFactory.class), mock(JoinedFactory.class), materializedFactory, mock(StreamJoinedFactory.class), mock(ConsumedFactory.class)));
}
use of io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1 in project ksql by confluentinc.
the class TableSuppressBuilderTest method init.
@Before
@SuppressWarnings("unchecked")
public void init() {
final ExecutionStepPropertiesV1 properties = new ExecutionStepPropertiesV1(queryContext);
when(physicalSchemaFactory.create(any(), any(), any())).thenReturn(physicalSchema);
materializedFactory = (a, b) -> materialized;
when(buildContext.buildValueSerde(any(), any(), any())).thenReturn(valueSerde);
when(executionKeyFactory.buildKeySerde(any(), any(), any())).thenReturn(keySerde);
when(buildContext.getKsqlConfig()).thenReturn(ksqlConfig);
when(ksqlConfig.getLong(any())).thenReturn(maxBytes);
when(tableHolder.getTable()).thenReturn(sourceKTable);
when(sourceKTable.transformValues(any(), any(Materialized.class))).thenReturn(preKTable);
when(preKTable.suppress(any())).thenReturn(suppressedKTable);
when(tableHolder.withTable(any(), any())).thenReturn(suppressedtable);
tableSuppress = new TableSuppress<>(properties, sourceStep, refinementInfo, internalFormats);
builder = new TableSuppressBuilder();
}
use of io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1 in project ksql by confluentinc.
the class SourceBuilderV1Test method givenUnwindowedSourceStream.
private void givenUnwindowedSourceStream(final int pseudoColumnVersion) {
when(buildContext.buildKeySerde(any(), any(), any())).thenReturn(keySerde);
givenConsumed(consumed, keySerde);
streamSource = new StreamSource(new ExecutionStepPropertiesV1(ctx), TOPIC_NAME, Formats.of(keyFormatInfo, valueFormatInfo, KEY_FEATURES, VALUE_FEATURES), TIMESTAMP_COLUMN, SOURCE_SCHEMA, OptionalInt.of(pseudoColumnVersion));
}
use of io.confluent.ksql.execution.plan.ExecutionStepPropertiesV1 in project ksql by confluentinc.
the class StreamAggregateBuilderTest method givenHoppingWindowedAggregate.
private void givenHoppingWindowedAggregate() {
givenTimeWindowedAggregate();
windowedAggregate = new StreamWindowedAggregate(new ExecutionStepPropertiesV1(CTX), sourceStep, Formats.of(KEY_FORMAT, VALUE_FORMAT, SerdeFeatures.of(), SerdeFeatures.of()), NON_AGG_COLUMNS, FUNCTIONS, new HoppingWindowExpression(Optional.empty(), new WindowTimeClause(WINDOW.getSeconds(), TimeUnit.SECONDS), new WindowTimeClause(HOP.getSeconds(), TimeUnit.SECONDS), Optional.of(retentionClause), Optional.of(gracePeriodClause)));
}
Aggregations