[BEAM-4069] Gracefully deserialize empty options structs#5126
Merged
Conversation
Contributor
Author
|
R: @kennknowles |
Contributor
Author
|
If I'm reading the Jenkins output correctly, this appears to be failing due to |
Contributor
Author
|
R: @tgroh |
tgroh
reviewed
Apr 16, 2018
| ObjectNode objectNode = jp.readValueAsTree(); | ||
| JsonNode rawOptionsNode = objectNode.get("options"); | ||
| ObjectNode optionsNode; | ||
| if (rawOptionsNode == null || rawOptionsNode.isNull()) { |
Member
There was a problem hiding this comment.
Can this not be pulled up some? e.g.
PipelineOptions options;
if (rawOptionsNode == null || rawOptionsNode.isNull()) {
options = PipelineOptionsFactory.create(); // or new ProxyInvocationHandler..., but I believe these to be equivalent
} else {
// code
options = ProxyInvocationHandler...
}
ValueProvider.RuntimeValueProvider.setRuntimeOptions(options)
return options;
Because the two if statements aren't independent - so we can just glom them together and have a more obvious path through the method.
Contributor
Author
There was a problem hiding this comment.
As it turns out, the second if statement is completely redundant. ;)
I wasn't confident about the equivalence between an empty ProxyInvocationHandler reconstruction and PipelineOptionsFactory.create(), so I've left that as it was.
Member
|
Cool LGTM |
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.
Follow this checklist to help us incorporate your contribution quickly and easily:
[BEAM-XXX] Fixes bug in ApproximateQuantiles, where you replaceBEAM-XXXwith the appropriate JIRA issue.mvn clean verifyto make sure basic checks pass. A more thorough check will be performed on your pull request automatically.