ableegoldman commented on code in PR #18194:
URL: https://github.com/apache/kafka/pull/18194#discussion_r1886119440
##########
streams/src/test/java/org/apache/kafka/streams/StreamsBuilderTest.java:
##########
@@ -2153,6 +2154,84 @@ public void shouldWrapProcessorsForTableTableOuterJoin()
{
assertThat(counter.numConnectedStateStores(), CoreMatchers.is(3));
}
+ @Test
+ public void shouldWrapProcessorsForForeignKeyInnerJoin() {
+ final Map<Object, Object> props = dummyStreamsConfigMap();
+ props.put(PROCESSOR_WRAPPER_CLASS_CONFIG,
RecordingProcessorWrapper.class);
+
+ final WrapperRecorder counter = new WrapperRecorder();
+ props.put(PROCESSOR_WRAPPER_COUNTER_CONFIG, counter);
+
+ final StreamsBuilder builder = new StreamsBuilder(new
TopologyConfig(new StreamsConfig(props)));
+
+ final KTable<String, String> left = builder.table("input1",
Consumed.as("input1"));
+ final KTable<String, String> right = builder.table("input2",
Consumed.as("input2"));
+
+ left.join(right,
+ value -> value,
+ (v1, v2) -> v1 + v2,
+ TableJoined.as("join"),
+ Materialized.<String, String, KeyValueStore<Bytes,
byte[]>>as("materialized-store").withValueSerde(Serdes.String()))
+ .toStream(Named.as("toStream"))
+ .to("output", Produced.as("sink"));
+
+ builder.build();
+ assertThat(counter.numWrappedProcessors(), CoreMatchers.is(9));
+ assertThat(counter.wrappedProcessorNames().toString(),
counter.wrappedProcessorNames(), Matchers.containsInAnyOrder(
+ "input1",
+ "input2",
+ "join-foreign-join-subscription",
+ "join-subscription-join-foreign",
+ "join-subscription-registration-processor",
+ "join-subscription-receive",
+ "join-result",
+ "join-subscription-response-resolver",
+ "toStream"
+ ));
+
+ assertThat(counter.numUniqueStateStores(), CoreMatchers.is(4)); //
table1, table2, subscription store, and join materialized
+ assertThat(counter.numConnectedStateStores(), CoreMatchers.is(5));
+ }
+
+ @Test
+ public void shouldWrapProcessorsForForeignKeyLeftJoin() {
+ final Map<Object, Object> props = dummyStreamsConfigMap();
+ props.put(PROCESSOR_WRAPPER_CLASS_CONFIG,
RecordingProcessorWrapper.class);
+
+ final WrapperRecorder counter = new WrapperRecorder();
+ props.put(PROCESSOR_WRAPPER_COUNTER_CONFIG, counter);
+
+ final StreamsBuilder builder = new StreamsBuilder(new
TopologyConfig(new StreamsConfig(props)));
+
+ final KTable<String, String> left = builder.table("input1",
Consumed.as("input1"));
+ final KTable<String, String> right = builder.table("input2",
Consumed.as("input2"));
+
+ left.leftJoin(right,
+ value -> value,
+ (v1, v2) -> v1 + v2,
+ TableJoined.as("l-join"),
+ Materialized.<String, String, KeyValueStore<Bytes,
byte[]>>as("materialized-store").withValueSerde(Serdes.String()))
+ .toStream(Named.as("toStream")) // 6
Review Comment:
copy-paste error 🙃 thanks
And yeah, it should have 5 stores
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]