use of io.confluent.ksql.execution.plan.StreamAggregate in project ksql by confluentinc.
the class StepSchemaResolverTest method shouldResolveSchemaForStreamAggregate.
@Test
public void shouldResolveSchemaForStreamAggregate() {
// Given:
givenAggregateFunction("SUM", SqlTypes.BIGINT);
final StreamAggregate step = new StreamAggregate(PROPERTIES, groupedStreamSource, formats, ImmutableList.of(ColumnName.of("ORANGE")), ImmutableList.of(functionCall("SUM", "APPLE")));
// When:
final LogicalSchema result = resolver.resolve(step, SCHEMA);
// Then:
assertThat(result, is(LogicalSchema.builder().keyColumn(ColumnName.of("K0"), SqlTypes.INTEGER).valueColumn(ColumnName.of("ORANGE"), SqlTypes.INTEGER).valueColumn(ColumnNames.aggregateColumn(0), SqlTypes.BIGINT).build()));
}
use of io.confluent.ksql.execution.plan.StreamAggregate in project ksql by confluentinc.
the class StreamAggregateBuilderTest method givenUnwindowedAggregate.
@SuppressWarnings({ "unchecked", "rawtypes" })
private void givenUnwindowedAggregate() {
when(materializedFactory.<GenericKey, KeyValueStore<Bytes, byte[]>>create(any(), any(), any())).thenReturn(materialized);
when(groupedStream.aggregate(any(), any(), any(Materialized.class))).thenReturn(aggregated);
when(aggregated.transformValues(any(), any(Named.class))).thenReturn((KTable) aggregatedWithResults);
aggregate = new StreamAggregate(new ExecutionStepPropertiesV1(CTX), sourceStep, Formats.of(KEY_FORMAT, VALUE_FORMAT, SerdeFeatures.of(), SerdeFeatures.of()), NON_AGG_COLUMNS, FUNCTIONS);
}
Aggregations