Commit 6f8b1e4
committed
kafka: emit arrangement key only when a user key encoder exists
The previous refactor conflated two distinct conditions under a single
key_is_synthetic flag: whether any key exists (user or relation) for PK
violation detection, and whether a user-configured key should be emitted to
the Kafka message. The old zip_into_diff_pairs stripped the emitted key
whenever user_key_indices.is_none() — covering both the relation-key case
and the synthetic-hash case. My refactor only stripped when BOTH were
absent, so for sinks with a relation key but no user key, the arrangement
key leaked through to encode_collection. The key_encoder is None in that
case (no user key_format was configured), and the expect("key present")
at line 1537 panicked.
Fix: gate the emitted key on key_encoder.is_some() instead of
!key_is_synthetic. Matches the old behavior exactly and is a local
decision the sink can make from its own config without a trait change.1 parent a0896b7 commit 6f8b1e4
1 file changed
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1496 | 1496 | | |
1497 | 1497 | | |
1498 | 1498 | | |
1499 | | - | |
| 1499 | + | |
| 1500 | + | |
| 1501 | + | |
| 1502 | + | |
1500 | 1503 | | |
1501 | 1504 | | |
1502 | 1505 | | |
| |||
0 commit comments