wuchong commented on a change in pull request #9335: [FLINK-13503][API] Add 
contract in `LookupableTableSource` to specify the behavior when lookupKeys 
contains null.
URL: https://github.com/apache/flink/pull/9335#discussion_r311845039
 
 

 ##########
 File path: 
flink-connectors/flink-jdbc/src/main/java/org/apache/flink/api/java/io/jdbc/JDBCLookupFunction.java
 ##########
 @@ -141,7 +169,12 @@ public void eval(Object... keys) {
                        try {
                                statement.clearParameters();
                                for (int i = 0; i < keys.length; i++) {
-                                       JDBCUtils.setField(statement, 
keySqlTypes[i], keys[i], i);
+                                       if (containsNull) {
+                                               JDBCUtils.setField(statement, 
keySqlTypes[i], keys[i], 2 * i);
+                                               JDBCUtils.setField(statement, 
keySqlTypes[i], keys[i], 2 * i + 1);
 
 Review comment:
   We can keep this special logic for now. But please open a JIRA to improve 
this. We can introduced a custom `NamedPreparedStatement` to pass each field 
only once. see 
https://www.javaworld.com/article/2077706/named-parameters-for-preparedstatement.html

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to