Repository navigation
Commit e2e28c7
fix: Keep a zero watermark delay threshold on a Kafka source
KafkaOptions.__init__ stored 'watermark_delay_threshold or None', and
timedelta(0) is falsy, so a delay of zero was read as 'not given':
KafkaOptions(..., watermark_delay_threshold=timedelta(0))
.watermark_delay_threshold -> None
to_proto().HasField(...) -> False
The value never reached the proto, so it was lost on apply and on every
registry round-trip, while timedelta(seconds=30) survived.
Both from_proto sites carried a branch mapping an explicit zero Duration
back to timedelta(days=0). That branch could not return anything: the
constructor it hands the value to dropped it. Feeding a proto that does
carry a zero Duration returned None.
KafkaSource.from_proto also tested the Duration message for truth
instead of presence. A protobuf message is always truthy, so an absent
delay entered the branch and came out as timedelta(days=0); only the
'or None' above hid it. KafkaOptions.from_proto, its sibling in this
file, already uses HasField, which is what both now use.
An absent delay stays None; a zero delay stays zero.
Signed-off-by: Rodrigo-Palma <[email protected]>1 parent 4771156 commit e2e28c7
2 files changed
Lines changed: 50 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
| 66 | + | |
69 | 67 | | |
70 | 68 | | |
71 | 69 | | |
| |||
552 | 550 | | |
553 | 551 | | |
554 | 552 | | |
555 | | - | |
| 553 | + | |
556 | 554 | | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
| 555 | + | |
561 | 556 | | |
562 | 557 | | |
563 | 558 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
1 | 3 | | |
2 | 4 | | |
3 | 5 | | |
| |||
333 | 335 | | |
334 | 336 | | |
335 | 337 | | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
0 commit comments