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-2803, BEAM-2706] JdbcIO improvements #3800
Conversation
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.
Generally speaking it looks good to me. I just have a question about the checkArgument()
change.
+ "null data source"); | ||
checkArgument(dataSource instanceof Serializable, | ||
"DataSourceConfiguration.create(dataSource) called with a dataSource not Serializable"); | ||
checkArgument(dataSource != null, "dataSource can not be 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.
Why not keeping the previous messages to be aligned with other IOs ?
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.
The style of messages is not really consistent between all IOs and I'm changing this one to be according to the best practices recently discussed on dev@ and currently recommended by PT Style Guide https://beam.apache.org/contribute/ptransform-style-guide/#validation
return toBuilder().setCoder(coder).build(); | ||
} | ||
|
||
@Override | ||
public PCollection<T> expand(PBegin input) { | ||
checkArgument(getQuery() != null, "withQuery() is required"); |
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.
Do we need these checkArgument()
s here as it's checked in the create ?
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.
withQuery() checks that you don't intentionally pass null to it; expand() checks that you didn't forget to call the withQuery() method at all.
@@ -253,6 +252,43 @@ public void setParameters(PreparedStatement preparedStatement) | |||
pipeline.run(); | |||
} | |||
|
|||
@Test | |||
@Category(NeedsRunner.class) |
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.
AFAIR NeedsRunner
is not required there.
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.
Done, thanks, removed it from other tests too!
e5daf60
to
bc9723a
Compare
Thanks, PTAL. |
retest this please |
1 similar comment
retest this please |
bc9723a
to
e5daf60
Compare
e5daf60
to
1476a3f
Compare
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.
LGTM. I will merge.
This solves two issues:
Also brings the validation messages in accordance with the updated guidance in PTransform Style Guide.
R: @jbonofre