use of io.confluent.ksql.execution.materialization.MaterializationInfo.MapperInfo in project ksql by confluentinc.
the class StreamAggregateBuilderTest method assertCorrectMaterializationBuilder.
private void assertCorrectMaterializationBuilder(final KTableHolder<?> result, final boolean windowed) {
assertThat(result.getMaterializationBuilder().isPresent(), is(true));
final MaterializationInfo info = result.getMaterializationBuilder().get().build();
assertThat(info.stateStoreName(), equalTo("agg-regate-Materialize"));
assertThat(info.getSchema(), equalTo(OUTPUT_SCHEMA));
assertThat(info.getStateStoreSchema(), equalTo(AGGREGATE_SCHEMA));
assertThat(info.getTransforms(), hasSize(1 + (windowed ? 1 : 0)));
final MapperInfo aggMapInfo = (MapperInfo) info.getTransforms().get(0);
final KsqlTransformer<Object, GenericRow> mapper = aggMapInfo.getMapper(name -> null);
// Given:
final GenericKey key = mock(GenericKey.class);
final GenericRow value = mock(GenericRow.class);
// When:
mapper.transform(key, value, ctx);
// Then:
verify(resultMapper).transform(key, value, ctx);
}
use of io.confluent.ksql.execution.materialization.MaterializationInfo.MapperInfo in project ksql by confluentinc.
the class TableAggregateBuilderTest method shouldBuildMaterializationCorrectlyForAggregate.
@Test
public void shouldBuildMaterializationCorrectlyForAggregate() {
// When:
final KTableHolder<?> result = aggregate.build(planBuilder, planInfo);
// Then:
assertThat(result.getMaterializationBuilder().isPresent(), is(true));
final MaterializationInfo info = result.getMaterializationBuilder().get().build();
assertThat(info.stateStoreName(), equalTo("agg-regate-Materialize"));
assertThat(info.getSchema(), equalTo(AGGREGATE_SCHEMA));
assertThat(info.getStateStoreSchema(), equalTo(AGGREGATE_SCHEMA));
assertThat(info.getTransforms(), hasSize(1));
final MapperInfo aggMapInfo = (MapperInfo) info.getTransforms().get(0);
final KsqlTransformer<Object, GenericRow> mapper = aggMapInfo.getMapper(name -> null);
// Given:
final GenericKey key = mock(GenericKey.class);
final GenericRow value = mock(GenericRow.class);
// When:
mapper.transform(key, value, ctx);
// Then:
verify(resultMapper).transform(key, value, ctx);
}
Aggregations