florin-akermann commented on code in PR #14107:
URL: https://github.com/apache/kafka/pull/14107#discussion_r1589921037


##########
streams/src/main/java/org/apache/kafka/streams/kstream/internals/foreignkeyjoin/SubscriptionSendProcessorSupplier.java:
##########
@@ -109,108 +111,102 @@ public void init(final ProcessorContext<KO, 
SubscriptionWrapper<K>> context) {
 
         @Override
         public void process(final Record<K, Change<V>> record) {
+            // clear cashed hash from previous record
+            recordHash = null;
             // drop out-of-order records from versioned tables (cf. KIP-914)
             if (useVersionedSemantics && !record.value().isLatest) {
                 LOG.info("Skipping out-of-order record from versioned table 
while performing table-table join.");
                 droppedRecordsSensor.record();
                 return;
             }
+            if (leftJoin) {
+                leftJoinInstructions(record);
+            } else {
+                defaultJoinInstructions(record);
+            }
+        }
 
-            final long[] currentHash = record.value().newValue == null ?
-                null :
-                Murmur3.hash128(valueSerializer.serialize(valueSerdeTopic, 
record.value().newValue));
-
-            final int partition = context().recordMetadata().get().partition();
+        private void leftJoinInstructions(final Record<K, Change<V>> record) {
             if (record.value().oldValue != null) {
                 final KO oldForeignKey = 
foreignKeyExtractor.apply(record.value().oldValue);
+                final KO newForeignKey = record.value().newValue == null ? 
null : foreignKeyExtractor.apply(record.value().newValue);
+                if (oldForeignKey != null && 
!Arrays.equals(serialize(newForeignKey), serialize(oldForeignKey))) {
+                    forward(record, oldForeignKey, DELETE_KEY_AND_PROPAGATE);
+                }
+                forward(record, newForeignKey, 
PROPAGATE_NULL_IF_NO_FK_VAL_AVAILABLE);

Review Comment:
   @mjsax omg, thanks for the flag! Looks like @AyoubOm is addressing it in 
https://issues.apache.org/jira/browse/KAFKA-16394 already? 
   
   



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