Search in sources :

Example 1 with StreamGroupByKey

use of io.confluent.ksql.execution.plan.StreamGroupByKey in project ksql by confluentinc.

the class StepSchemaResolverTest method shouldResolveSchemaForStreamGroupByKey.

@Test
public void shouldResolveSchemaForStreamGroupByKey() {
    // Given:
    final StreamGroupByKey step = new StreamGroupByKey(PROPERTIES, streamSource, formats);
    // When:
    final LogicalSchema result = resolver.resolve(step, SCHEMA);
    // Then:
    assertThat(result, is(SCHEMA));
}
Also used : StreamGroupByKey(io.confluent.ksql.execution.plan.StreamGroupByKey) LogicalSchema(io.confluent.ksql.schema.ksql.LogicalSchema) Test(org.junit.Test)

Example 2 with StreamGroupByKey

use of io.confluent.ksql.execution.plan.StreamGroupByKey in project ksql by confluentinc.

the class StreamGroupByBuilderTest method init.

@Before
@SuppressWarnings("unchecked")
public void init() {
    when(streamHolder.getSchema()).thenReturn(SCHEMA);
    when(streamHolder.getStream()).thenReturn(sourceStream);
    when(paramsFactory.build(any(), any(), any())).thenReturn(groupByParams);
    when(groupByParams.getSchema()).thenReturn(REKEYED_SCHEMA);
    when(groupByParams.getMapper()).thenReturn(mapper);
    when(buildContext.getKsqlConfig()).thenReturn(ksqlConfig);
    when(buildContext.getFunctionRegistry()).thenReturn(functionRegistry);
    when(buildContext.buildKeySerde(any(), any(), any())).thenReturn(keySerde);
    when(buildContext.buildValueSerde(any(), any(), any())).thenReturn(valueSerde);
    when(buildContext.getProcessingLogger(any())).thenReturn(processingLogger);
    when(groupedFactory.create(any(), any(Serde.class), any())).thenReturn(grouped);
    when(sourceStream.groupByKey(any(Grouped.class))).thenReturn(groupedStream);
    when(sourceStream.filter(any())).thenReturn(filteredStream);
    when(filteredStream.groupBy(any(KeyValueMapper.class), any(Grouped.class))).thenReturn(groupedStream);
    groupBy = new StreamGroupBy<>(PROPERTIES, sourceStep, FORMATS, GROUP_BY_EXPRESSIONS);
    groupByKey = new StreamGroupByKey(PROPERTIES, sourceStep, FORMATS);
    builder = new StreamGroupByBuilder(buildContext, groupedFactory, paramsFactory);
}
Also used : Serde(org.apache.kafka.common.serialization.Serde) StreamGroupByKey(io.confluent.ksql.execution.plan.StreamGroupByKey) KeyValueMapper(org.apache.kafka.streams.kstream.KeyValueMapper) Grouped(org.apache.kafka.streams.kstream.Grouped) Before(org.junit.Before)

Example 3 with StreamGroupByKey

use of io.confluent.ksql.execution.plan.StreamGroupByKey in project ksql by confluentinc.

the class StreamGroupByBuilderV1Test method init.

@Before
@SuppressWarnings("unchecked")
public void init() {
    when(streamHolder.getSchema()).thenReturn(SCHEMA);
    when(streamHolder.getStream()).thenReturn(sourceStream);
    when(paramsFactory.build(any(), any(), any())).thenReturn(groupByParams);
    when(groupByParams.getSchema()).thenReturn(REKEYED_SCHEMA);
    when(groupByParams.getMapper()).thenReturn(mapper);
    when(buildContext.getKsqlConfig()).thenReturn(ksqlConfig);
    when(buildContext.getFunctionRegistry()).thenReturn(functionRegistry);
    when(buildContext.buildKeySerde(any(), any(), any())).thenReturn(keySerde);
    when(buildContext.buildValueSerde(any(), any(), any())).thenReturn(valueSerde);
    when(buildContext.getProcessingLogger(any())).thenReturn(processingLogger);
    when(groupedFactory.create(any(), any(Serde.class), any())).thenReturn(grouped);
    when(sourceStream.groupByKey(any(Grouped.class))).thenReturn(groupedStream);
    when(sourceStream.filter(any())).thenReturn(filteredStream);
    when(filteredStream.groupBy(any(KeyValueMapper.class), any(Grouped.class))).thenReturn(groupedStream);
    groupBy = new StreamGroupByV1<>(PROPERTIES, sourceStep, FORMATS, GROUP_BY_EXPRESSIONS);
    groupByKey = new StreamGroupByKey(PROPERTIES, sourceStep, FORMATS);
    builder = new StreamGroupByBuilderV1(buildContext, groupedFactory, paramsFactory);
}
Also used : Serde(org.apache.kafka.common.serialization.Serde) StreamGroupByKey(io.confluent.ksql.execution.plan.StreamGroupByKey) KeyValueMapper(org.apache.kafka.streams.kstream.KeyValueMapper) Grouped(org.apache.kafka.streams.kstream.Grouped) Before(org.junit.Before)

Aggregations

StreamGroupByKey (io.confluent.ksql.execution.plan.StreamGroupByKey)3 Serde (org.apache.kafka.common.serialization.Serde)2 Grouped (org.apache.kafka.streams.kstream.Grouped)2 KeyValueMapper (org.apache.kafka.streams.kstream.KeyValueMapper)2 Before (org.junit.Before)2 LogicalSchema (io.confluent.ksql.schema.ksql.LogicalSchema)1 Test (org.junit.Test)1