MINOR: update the KStream#branch(split) doc and java doc and tests#11195
Merged
mjsax merged 1 commit intoapache:trunkfrom Aug 10, 2021
Merged
MINOR: update the KStream#branch(split) doc and java doc and tests#11195mjsax merged 1 commit intoapache:trunkfrom
mjsax merged 1 commit intoapache:trunkfrom
Conversation
showuon
commented
Aug 10, 2021
| @Override | ||
| public Branched<K, V> withName(final String name) { | ||
| Objects.requireNonNull(name, "name cannot be null"); | ||
| return new Branched<>(name, chainFunction, chainConsumer); |
Member
Author
There was a problem hiding this comment.
We have a similar method: as that accept a name parameter to create a Branched instance here. We did a name null check there. We should also have a null check here for consistency.
public static <K, V> Branched<K, V> as(final String name) {
Objects.requireNonNull(name, "name cannot be null");
return new Branched<>(name, null, null);
}
showuon
commented
Aug 10, 2021
| * .branch(predicate3, Branched.withFunction(ks->null)) // no entry: chain function returns null | ||
| * .branch(predicate4) // "foo-4": name defaults to the branch position | ||
| * .branch(predicate4, Branched.withFunction(ks->ks)) // "foo-4": chain function returns non-null value | ||
| * .branch(predicate5) // "foo-5": name defaults to the branch position |
Member
Author
There was a problem hiding this comment.
add an example to explain the function return with non-null result case.
showuon
commented
Aug 10, 2021
| // "foo-4": chain function returns non-null value | ||
| .branch(isNegative, Branched.withFunction(ks -> ks)) | ||
| // "foo-5": name defaults to the branch position | ||
| .branch(isMultipleOfSeven) |
Member
Author
There was a problem hiding this comment.
add a test case for function return with non-null result case.
Member
Author
|
@inponomarev @mjsax @vvcephei , please help review this PR. Thanks. |
inponomarev
approved these changes
Aug 10, 2021
inponomarev
approved these changes
Aug 10, 2021
mjsax
pushed a commit
that referenced
this pull request
Aug 10, 2021
Reviewers: Ivan Ponomarev <iponomarev@mail.ru>, Matthias J. Sax <matthias@confluent.io>
mjsax
pushed a commit
that referenced
this pull request
Aug 10, 2021
Reviewers: Ivan Ponomarev <iponomarev@mail.ru>, Matthias J. Sax <matthias@confluent.io>
Member
|
Thanks for the PR @showuon! Merged to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
After KAFKA-5488: Add type-safe split() operator #9107 (KIP-418), the returned content is not
kstream[]anymore. Also, this description:If no predicate matches, the the record is dropped.is not right now.It'll be routed to the default branch, or dropped if no default branch is created.Fix them.Branched.withFunction()with non-null result test case.Committer Checklist (excluded from commit message)