aliehsaeedii commented on code in PR #16218: URL: https://github.com/apache/kafka/pull/16218#discussion_r1858479526
########## streams/src/main/java/org/apache/kafka/streams/kstream/internals/foreignkeyjoin/ForeignTableJoinProcessorSupplier.java: ########## @@ -111,34 +110,26 @@ public void process(final Record<KO, Change<VO>> record) { return; } - final Bytes prefixBytes = keySchema.prefixBytes(record.key()); + final Bytes foreignKeyBytes = keySchema.prefixBytes(record.key()); //Perform the prefixScan and propagate the results try (final KeyValueIterator<Bytes, ValueAndTimestamp<SubscriptionWrapper<K>>> prefixScanResults = - subscriptionStore.range(prefixBytes, Bytes.increment(prefixBytes))) { + subscriptionStore.prefixScan(foreignKeyBytes, new BytesSerializer())) { Review Comment: @AyoubOm By `if (prefixScanResults.hasNext() || prefixEquals(next.key.get(), foreignKeyBytes.get()))` I assume you mean `if (next.hasNext() || prefixEquals(next.key.get(), foreignKeyBytes.get()))`. Anyways, I think foreign keys are not unique, therefore, a key which is out of range (`b` for example while we are interested only in `a`) may have further elements in the iterator. I tried to run the unit tests and I noticed in [this test](https://github.com/apache/kafka/blob/cebec91470c440a1735e50210ae3fc0f62ee40a7/streams/src/test/java/org/apache/kafka/streams/kstream/internals/foreignkeyjoin/ForeignTableJoinProcessorSupplierTests.java#L96-#L113) for example, the range is from `fk1` to `Bytes.increment(prefixBytes)` which is `fk2`. The output of `range` contains only the records with `fk1` keys, even if other records with `fk2` or `fk11` has been added to the store! -- 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