-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KAFKA-3902 #1556
KAFKA-3902 #1556
Changes from 1 commit
3827d91
e07388b
3563044
721e00d
0a93d16
1919fa5
aa036cb
a607e24
e6beae8
a8f9ef7
7c277cf
73479d3
b039e4e
356b0a6
66aada0
b2f5c06
0fe41c8
5b19a71
c1e4ddf
117c661
525d1b4
1dccdba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,9 @@ public void process(K key, Change<V> change) { | |
V newValue = computeValue(key, change.newValue); | ||
V oldValue = sendOldValues ? computeValue(key, change.oldValue) : null; | ||
|
||
if (sendOldValues && oldValue == null && newValue == null) return; // unnecessary to forward here. | ||
if ((sendOldValues && oldValue == null && newValue == null) || | ||
(change.oldValue == null && change.newValue == null)) return; // unnecessary to forward here. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually I think we do not need the second condition here, since a better fix would be in the Also minor comment: use a new line for "return" for better debugging, and move the comment on top of line 80 as "if both the new and old values are null after the filtering, do not need to forward downstream anymore". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems the minor comment is not addressed in your latest PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I confirm that you are absolutely right about your last mail about trying to remove sendOldValues from test is an error and I had misunderstood the implication. I also appreciate the debug-friendly syntax of return on next line, I'll adjust that. I'll also remove the change test as per your comment above that spells out you want to handle that in mapValues function. Hopefully, things will be sorted out within an hour or so. |
||
|
||
context().forward(key, new Change<>(newValue, oldValue)); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add a check on the original
change
value thatnewValue
andoldValue
cannot be both null?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean something semantically equivalent to
if (change.oldValue == null && change.newValue == null) return;
or rather
if (sendOldValues && change.oldValue == null && change.newValue == null) return;
I'd like to understand whether you're addressing case 2 alone or case 2 and 3. Once I am clear on what you mean, I can make change and test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually never mind, I was originally thinking that after this patch we should
if (change.oldValue == null && change.newValue == null) throw StreamsException
, since it should not happen; but I just realized a mapValues operator can still make both values to be null and pass it to the downstream filter.