raminqaf commented on code in PR #15601:
URL: https://github.com/apache/kafka/pull/15601#discussion_r1600077088


##########
streams/src/main/java/org/apache/kafka/streams/kstream/internals/KStreamKStreamJoin.java:
##########
@@ -43,7 +42,7 @@
 import static 
org.apache.kafka.streams.StreamsConfig.InternalConfig.EMIT_INTERVAL_MS_KSTREAMS_OUTER_JOIN_SPURIOUS_RESULTS_FIX;
 import static 
org.apache.kafka.streams.processor.internals.metrics.TaskMetrics.droppedRecordsSensor;
 
-class KStreamKStreamJoin<K, V1, V2, VOut> implements ProcessorSupplier<K, V1, 
K, VOut> {
+abstract class KStreamKStreamJoin<K, VL, VR, VOut, VThis, VOther> implements 
ProcessorSupplier<K, VThis, K, VOut> {

Review Comment:
   We needed a way to detect the type of the side being called dynamically. So 
that the super class can handle them based on the caller. It also ensures the 
type safety.
   
   When this class is called by the _left side_ of the join `VThis` would be 
_left_ left type (`VLeft`) and `VOther` would be _right_ type (`VRight`).
   
   ```java
   class KStreamKStreamLeftJoinSide<K, VLeft, VRight, VOut> extends 
KStreamKStreamJoin<K, VLeft, VRight, VOut, VLeft, VRight> {
                                                                                
                                                                                
                                                        --^--  --^---
                                                                                
                                                                                
                                                        VThis VOther
   ```
   
   Whereas for the _right side_ of the join `VThis` would be _right_ left type 
(`VRight`) and `VOther` would be _left_ type (`VLeft`).
   
   ```java
   class KStreamKStreamRightJoinSide<K, VLeft, VRight, VOut> extends 
KStreamKStreamJoin<K, VLeft, VRight, VOut, VRight, VLeft>
                                                                                
                                                                                
                                                        --^--  --^---
                                                                                
                                                                                
                                                        VThis VOther
   ```
   



##########
streams/src/main/java/org/apache/kafka/streams/kstream/internals/KStreamKStreamJoin.java:
##########
@@ -43,7 +42,7 @@
 import static 
org.apache.kafka.streams.StreamsConfig.InternalConfig.EMIT_INTERVAL_MS_KSTREAMS_OUTER_JOIN_SPURIOUS_RESULTS_FIX;
 import static 
org.apache.kafka.streams.processor.internals.metrics.TaskMetrics.droppedRecordsSensor;
 
-class KStreamKStreamJoin<K, V1, V2, VOut> implements ProcessorSupplier<K, V1, 
K, VOut> {
+abstract class KStreamKStreamJoin<K, VL, VR, VOut, VThis, VOther> implements 
ProcessorSupplier<K, VThis, K, VOut> {

Review Comment:
   We needed a way to detect the type of the side being called dynamically so 
that the super class can handle them based on the caller. This also ensures 
type safety.
   
   When this class is called by the _left side_ of the join `VThis` would be 
_left_ left type (`VLeft`) and `VOther` would be _right_ type (`VRight`).
   
   ```java
   class KStreamKStreamLeftJoinSide<K, VLeft, VRight, VOut> extends 
KStreamKStreamJoin<K, VLeft, VRight, VOut, VLeft, VRight> {
                                                                                
                                                                                
                                                        --^--  --^---
                                                                                
                                                                                
                                                        VThis VOther
   ```
   
   Whereas for the _right side_ of the join `VThis` would be _right_ left type 
(`VRight`) and `VOther` would be _left_ type (`VLeft`).
   
   ```java
   class KStreamKStreamRightJoinSide<K, VLeft, VRight, VOut> extends 
KStreamKStreamJoin<K, VLeft, VRight, VOut, VRight, VLeft>
                                                                                
                                                                                
                                                        --^--  --^---
                                                                                
                                                                                
                                                        VThis VOther
   ```
   



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to