ableegoldman commented on code in PR #18048:
URL: https://github.com/apache/kafka/pull/18048#discussion_r1881081648


##########
streams/src/test/java/org/apache/kafka/streams/StreamsBuilderTest.java:
##########
@@ -1816,6 +1816,102 @@ public void 
shouldWrapProcessorsForStreamTableJoinWithGracePeriod() {
         assertThat(counter.numConnectedStateStores(), CoreMatchers.is(2));
     }
 
+    @Test
+    public void shouldWrapProcessorsForTableTableInnerJoin() {
+        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> t1 = builder.table("input1", 
Consumed.as("input1")); // 1
+        final KTable<String, String> t2 = builder.table("input2", 
Consumed.as("input2")); // 2
+
+        t1.join(t2, (v1, v2) -> v1 + v2, Named.as("join-processor"), 
Materialized.as("the_join")) // 3 (this), 4 (other), 5 (merger)
+                .toStream(Named.as("toStream")) // 6
+                .to("output", Produced.as("sink"));
+
+        builder.build();
+        assertThat(counter.numWrappedProcessors(), CoreMatchers.is(6));
+        assertThat(counter.wrappedProcessorNames().toString(), 
counter.wrappedProcessorNames(), Matchers.containsInAnyOrder(
+                "input1",
+                "input2",
+                "join-processor-join-this",
+                "join-processor-join-other",
+                "join-processor",
+                "toStream"
+        ));
+
+        assertThat(counter.numUniqueStateStores(), CoreMatchers.is(3)); // one 
for join this, one for join that
+        assertThat(counter.numConnectedStateStores(), CoreMatchers.is(3));
+    }
+
+    @Test
+    public void shouldWrapProcessorsForTableTableLeftJoin() {
+        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> t1 = builder.table("input1", 
Consumed.as("input1")); // 1
+        final KTable<String, String> t2 = builder.table("input2", 
Consumed.as("input2")); // 2
+
+        t1.leftJoin(t2, (v1, v2) -> v1 + v2, Named.as("join-processor")) // 3 
(this), 4 (other), 5 (merger)
+                .toStream(Named.as("toStream")) // 6
+                .to("output", Produced.as("sink"));
+
+        builder.build();
+        assertThat(counter.numWrappedProcessors(), CoreMatchers.is(6));
+        assertThat(counter.wrappedProcessorNames().toString(), 
counter.wrappedProcessorNames(), Matchers.containsInAnyOrder(
+                "input1",
+                "input2",
+                "join-processor-join-this",
+                "join-processor-join-other",
+                "join-processor",
+                "toStream"
+        ));
+
+        assertThat(counter.numUniqueStateStores(), CoreMatchers.is(2)); // one 
for join this, one for join that
+        assertThat(counter.numConnectedStateStores(), CoreMatchers.is(2));

Review Comment:
   ```suggestion
           assertThat(counter.numUniqueStateStores(), CoreMatchers.is(3)); // 
table1, table2, join materialized
           assertThat(counter.numConnectedStateStores(), CoreMatchers.is(3));
   ```



-- 
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]

Reply via email to