use of io.confluent.ksql.execution.plan.JoinType in project ksql by confluentinc.
the class SchemaKStreamTest method shouldBuildStepForStreamStreamJoin.
@Test
// can be fixed after GRACE clause is made mandatory
@SuppressWarnings({ "rawtypes", "deprecation" })
public void shouldBuildStepForStreamStreamJoin() {
// Given:
final SchemaKStream initialSchemaKStream = buildSchemaKStreamForJoin(ksqlStream);
final List<Pair<JoinType, StreamStreamJoin>> cases = ImmutableList.of(Pair.of(JoinType.OUTER, initialSchemaKStream::outerJoin), Pair.of(JoinType.LEFT, initialSchemaKStream::leftJoin), Pair.of(JoinType.INNER, initialSchemaKStream::innerJoin));
final JoinWindows joinWindows = JoinWindows.of(Duration.ofSeconds(1));
final WindowTimeClause grace = new WindowTimeClause(5, TimeUnit.SECONDS);
final WithinExpression withinExpression = new WithinExpression(1, TimeUnit.SECONDS, grace);
for (final Pair<JoinType, StreamStreamJoin> testcase : cases) {
final SchemaKStream joinedKStream = testcase.right.join(schemaKStream, KEY, withinExpression, valueFormat.getFormatInfo(), valueFormat.getFormatInfo(), childContextStacker);
// Then:
assertThat(joinedKStream.getSourceStep(), equalTo(ExecutionStepFactory.streamStreamJoin(childContextStacker, testcase.left, KEY, InternalFormats.of(keyFormat, valueFormat.getFormatInfo()), InternalFormats.of(keyFormat, valueFormat.getFormatInfo()), initialSchemaKStream.getSourceStep(), schemaKStream.getSourceStep(), joinWindows, Optional.of(grace))));
}
}
Aggregations