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
[BEAM-4303] Enforce ErrorProne analysis in examples project #5521
[BEAM-4303] Enforce ErrorProne analysis in examples project #5521
Conversation
c714f26
to
b7ec71f
Compare
@swegner is there a way to mark ignores at the module level ? We should not expose guava's Splitter in the most basic examples, e.g. Wordcount/WindowedWordcount (because those are commonly copy pasted) and using the |
Great point. I can update the string splits to have a |
b7ec71f
to
96919d1
Compare
@iemejia currently we have a global set of excludes in the I agree with making examples simple and avoiding a Guava dependency, but also note that examples tend to get copy-pasted many times, so we should try to avoid known anti-patterns if possible. As @cademarkegard points out, the StringSplitter ErrorProne page also suggests using |
f81bac3
to
a450231
Compare
if ("timestamp".equals(laneInfo[0])) { | ||
// Header row | ||
return; | ||
} | ||
if (laneInfo.length < 48) { | ||
if (laneInfo.length < 50) { |
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.
Can you elaborate on what this change is for? I'm not sure what this magic number represents. If you are familiar, perhaps extract it out as a named constant that provides some context. i.e. const int NUM_FIELDS = 50;
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.
This value change is necessary after changing the c.element().split()
to have limit of -1
. In the second input data, when we didn't have the limit set, split()
would actually truncate the fields following after the last 0
on line 61 resulting in length of 45. After setting the limit, it increased the number of fields to 49 for that input. We still maintained 50 fields for the input that starts on line 59, which textExtractTotalFlow() seems to care about.
Great suggestion on the constant, I'll push up the change with that now.
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.
Got it, thanks for the explanation!
Just one comment above, then everything else LGTM (looks good to me). |
b656b88
to
7081b19
Compare
7081b19
to
ce1f2f5
Compare
LGTM. I'll leave it to @iemejia to merge in case he has any other feedback. |
LGTM. Thanks @cademarkegard ! |
failOnWarning