Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

jkff
Copy link
Contributor

@jkff jkff commented Sep 1, 2017

This solves two issues:

Also brings the validation messages in accordance with the updated guidance in PTransform Style Guide.

R: @jbonofre

@coveralls
Copy link

Coverage Status

Coverage increased (+0.003%) to 69.741% when pulling e5daf60 on jkff:jdbcio-improvements into c9653f2 on apache:master.

Copy link
Member

@jbonofre jbonofre left a 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");
Copy link
Member

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 ?

Copy link
Contributor Author

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");
Copy link
Member

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 ?

Copy link
Contributor Author

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)
Copy link
Member

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.

Copy link
Contributor Author

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!

@jkff
Copy link
Contributor Author

jkff commented Sep 5, 2017

Thanks, PTAL.

@jbonofre
Copy link
Member

jbonofre commented Sep 5, 2017

retest this please

1 similar comment
@jkff
Copy link
Contributor Author

jkff commented Sep 5, 2017

retest this please

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.01%) to 69.668% when pulling 1476a3f on jkff:jdbcio-improvements into 8b540d2 on apache:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.007%) to 69.671% when pulling 1476a3f on jkff:jdbcio-improvements into 8b540d2 on apache:master.

Copy link
Member

@jbonofre jbonofre left a 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.

@asfgit asfgit closed this in 7fe5b75 Sep 6, 2017
@jkff jkff deleted the jdbcio-improvements branch September 6, 2017 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants