-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Flink 3750 fixed #1941
Flink 3750 fixed #1941
Conversation
|
||
public JDBCInputFormat() { | ||
} | ||
|
||
@Override | ||
public void configure(Configuration parameters) { | ||
//called once per inputFormat (on open) | ||
try { | ||
establishConnection(); |
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.
Use the new method in RichInputFormat
(openInputFormat()
and closeInputFormat()
)
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.
I think I forgotto include the new connection management when I closed the previous branch..
Thanks for the PR @fpompermaier. To make it more general I would propose to:
What do you think? |
/** | ||
* Query parameters container | ||
*/ | ||
public class QueryParamInputSplit implements InputSplit { |
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.
I don't think we need a special InputSplit.
If we store the binding values in a Object[][] member variable of the JDBCInputFormat, we only need an index to look up the respective values. So we can use GenericInputSplit
which has a split number that can be used as index.
Thanks for the update @fpompermaier. I added a few comments and suggestions. |
* This splits generator allows the apply user defined splits (computed outside the IF) | ||
* | ||
* */ | ||
public class GenericSplitsGenerator implements JDBCInputSplitsGenerator { |
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.
Please rename to GenericParameterValueProvider
ea58168
to
b0dd704
Compare
@@ -81,25 +134,51 @@ public void configure(Configuration parameters) { | |||
* @throws IOException | |||
*/ | |||
@Override | |||
public void open(InputSplit ignored) throws IOException { | |||
public void open(InputSplit inputSplit) throws IOException { |
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.
JavaDocs need to be updated for new parameter name
@@ -352,6 +318,10 @@ public JDBCInputFormatBuilder setResultSetConcurrency(int resultSetConcurrency) | |||
format.resultSetConcurrency = resultSetConcurrency; | |||
return this; | |||
} | |||
public JDBCInputFormatBuilder setParametersProvider(ParameterValuesProvider parameterValuesProvider) { |
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.
Add new line above
Thanks for the update @fpompermaier. Overall the PR looks good. I added a few comments and suggestions. Thanks, Fabian |
* | ||
* WARNING: this may fail if the JDBC driver doesn't handle null correctly and no column types specified in the SqlRow | ||
* WARNING: this may fail when no column types specified (because a best effort approach is attempted in order to |
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 warning should also go into the JavaDocs of the JdbcOutputFormat
class.
Hi @fpompermaier, I added one more comment. I'm not sure if you noticed the other two comments I made a fews day back to |
* query template (i.e. a valid {@link PreparedStatement}) and a {@link ParameterValuesProvider} | ||
* which provides binding values for the query parameters. | ||
* | ||
* A valid RowTypeInfo must be properly configured in the builder, e.g.: </br> |
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.
Thanks for the nice JavaDocs!
Thanks for the update @fpompermaier. Just had a few minor comments. After that this PR should be good to merge. |
Thanks for the update. Looks good. Will merge it later :-) |
Merging |
…ormat. - New Input- and OutputFormat use Row instead of Tuple types to support null values. - JdbcInputFormat supports parallel input due to PreparedStatement and binding values for parameters. This closes apache#1941
Thanks for contributing to Apache Flink. Before you open your pull request, please take the following check list into consideration.
If your changes take all of the items into account, feel free to open your pull request. For more information and/or questions please refer to the How To Contribute guide.
In addition to going through the list, please provide a meaningful description of your changes.
mvn clean verify
has been executed successfully locally or a Travis build has passedNew cleaned PR aligned with the current master