# KTable-KTable Foreign-Key LEFT JOIN: Discrepancy between documentation and behavior when FK is NULL

**URL:** <https://forum.confluent.io/t/ktable-ktable-foreign-key-left-join-discrepancy-between-documentation-and-behavior-when-fk-is-null/38300>\
**Category:** Kafka Streams\
**Created:** [20 March 2026 11:10 UTC](https://forum.confluent.io/t/ktable-ktable-foreign-key-left-join-discrepancy-between-documentation-and-behavior-when-fk-is-null/38300 "2026-03-20T11:10:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![foal](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/foal/32/3692_2.png) [@foal](https://forum.confluent.io/u/foal)\
**Post date:** [20 March 2026 11:10 UTC](https://forum.confluent.io/t/ktable-ktable-foreign-key-left-join-discrepancy-between-documentation-and-behavior-when-fk-is-null/38300/1 "2026-03-20T11:10:03Z")

</div>

# KTable-KTable Foreign-Key LEFT JOIN: Discrepancy between documentation and behavior when FK is NULL

## Summary

I’m observing a discrepancy between the documented semantics table and the actual runtime behavior of `KTable-KTable` foreign-key LEFT JOIN when the `foreignKeyExtractor` returns `null`.

## Documentation Reference

[Kafka Streams DSL - KTable-KTable Foreign-Key Join](https://kafka.apache.org/42/streams/developer-guide/dsl-api/#ktable-ktable-foreign-key-join)

## The Discrepancy

### 1. The semantics table shows (row with offset=5):

| Record Offset | Left KTable (K, extracted-FK) | Right KTable (FK, VR) | (INNER) JOIN | LEFT JOIN |
| --- | --- | --- | --- | --- |
| 5 | (k, null) | | (k, null) | **(k, null, null)** |

This suggests that when the foreign key is `null`, a LEFT JOIN should output the left record with `null` for the right-side value — consistent with standard SQL LEFT JOIN semantics.

### 2. However, the text states:

> “Records for which the `foreignKeyExtractor` produces `null` are ignored and do not trigger a join.”

### 3. Runtime behavior confirms records are dropped:

WARN o.a.k.s.k.i.f.SubscriptionSendProcessorSupplier - Skipping record due to null foreign key. topic=[my-topic] partition=[12] offset=[6224]

## Question

1. **Which behavior is correct?** Should LEFT JOIN with `null` FK:
  - (A) Output the left record with `null` right-side value (as the semantics table suggests), or
  - (B) Drop/ignore the record entirely (as the text states and implementation does)?

2. If (B) is the intended behavior, **is the semantics table incorrect** and should be updated?
3. If (A) is the intended behavior, **is this a bug** in `SubscriptionSendProcessorSupplier` that should be reported?

## Expected vs Actual

| Scenario | Expected (per table) | Actual (runtime) |
| --- | --- | --- |
| Left record with FK=null, LEFT JOIN | Output: `(key, null, null)` | Record dropped with WARN log |

## Environment

- Kafka Streams version: 4.1.1

## Workaround

The documentation suggests using a sentinel value (e.g., `"NULL"` or `-1`) instead of `null`, but this requires ensuring no right-side record exists for the sentinel key and adds complexity.

* * *

Thank you for any clarification on the intended semantics!

---

<div class="post-metadata">

**Author:** ![mjsax](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/mjsax/32/3113_2.png) [@mjsax](https://forum.confluent.io/u/mjsax)\
**Post date:** [20 March 2026 17:22 UTC](https://forum.confluent.io/t/ktable-ktable-foreign-key-left-join-discrepancy-between-documentation-and-behavior-when-fk-is-null/38300/2 "2026-03-20T17:22:19Z")

</div>

Since 3.7 release, when the FK-extractor returns a `null` key for a left-join, you should get a join result. (cf [KIP-962: Relax non-null key requirement in Kafka Streams - Apache Kafka - Apache Software Foundation](https://cwiki.apache.org/confluence/display/KAFKA/KIP-962%3A+Relax+non-null+key+requirement+in+Kafka+Streams) )

So the table in the docs is right. The other test snippet you quote, is for inner-join thought, and I cannot see it in the left-join docs… So docs seems to be correct about this, too.

 ![Screenshot 2026-03-20 at 10.20.12 AM](https://us1.discourse-cdn.com/flex019/uploads/confluentcommunity/original/2X/3/3b155ce0bfcb2e680b94e91b6d135eec2c39fb2b.png)

However, I don’t understand, base on the code, why you see the logging. It should only happen for inner-join:

- left-join code: [kafka/streams/src/main/java/org/apache/kafka/streams/kstream/internals/foreignkeyjoin/SubscriptionSendProcessorSupplier.java at be816b82d25370ceac697ccf7c88cea873e9b4e3 · apache/kafka · GitHub](https://github.com/apache/kafka/blob/be816b82d25370ceac697ccf7c88cea873e9b4e3/streams/src/main/java/org/apache/kafka/streams/kstream/internals/foreignkeyjoin/SubscriptionSendProcessorSupplier.java#L130-L142)
- only inner-join code calls `logSkippedRecordDueToNullForeignKey` → [kafka/streams/src/main/java/org/apache/kafka/streams/kstream/internals/foreignkeyjoin/SubscriptionSendProcessorSupplier.java at be816b82d25370ceac697ccf7c88cea873e9b4e3 · apache/kafka · GitHub](https://github.com/apache/kafka/blob/be816b82d25370ceac697ccf7c88cea873e9b4e3/streams/src/main/java/org/apache/kafka/streams/kstream/internals/foreignkeyjoin/SubscriptionSendProcessorSupplier.java#L199-L211)

So I am wondering now, if you might by accident use `leftTable.join(rightTable,…)` instead of `leftTable.leftJoin(rightTable,…)` in your program?
