snuyanzin commented on code in PR #79:
URL: 
https://github.com/apache/flink-connector-jdbc/pull/79#discussion_r1444006740


##########
flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/table/ParameterizedPredicate.java:
##########
@@ -52,8 +69,26 @@ public void setPredicate(String predicate) {
     }
 
     public ParameterizedPredicate combine(String operator, 
ParameterizedPredicate that) {
+        int paramIndex = String.format("(%s %s ", this.predicate, 
operator).length();
+        if (!that.indexesOfPredicatePlaceHolders.isEmpty()) {
+            paramIndex = paramIndex + 
that.indexesOfPredicatePlaceHolders.get(0);

Review Comment:
   looks like a strange thing assuming that there is no more than one element 
inside the list
   
   as a result more complex queries are failing , an example of query which 
fails
   ```sql
   SELECT * FROM a JOIN d FOR SYSTEM_TIME AS OF a.proctime 
      ON ((d.age < 50 AND d.type = 1 AND d.age > 0) 
      OR (d.age < 70 AND d.type = 6 AND d.age > 10)) AND a.ip = d.ip
   ```
   
   it fails with 
   ```
   Caused by: java.lang.IndexOutOfBoundsException: Index: 3, Size: 3
        at java.util.ArrayList.rangeCheck(ArrayList.java:659)
        at java.util.ArrayList.get(ArrayList.java:435)
        at 
org.apache.flink.connector.jdbc.table.JdbcDynamicTableSource.getResolvedConditions(JdbcDynamicTableSource.java:157)
        at 
org.apache.flink.connector.jdbc.table.JdbcDynamicTableSource.getLookupRuntimeProvider(JdbcDynamicTableSource.java:120)
        at 
org.apache.flink.table.planner.plan.utils.LookupJoinUtil.createLookupRuntimeProvider(LookupJoinUtil.java:626)
        at 
org.apache.flink.table.planner.plan.utils.LookupJoinUtil.isAsyncLookup(LookupJoinUtil.java:413)
        at 
org.apache.flink.table.planner.plan.nodes.physical.common.CommonPhysicalLookupJoin.isAsyncEnabled$lzycompute(CommonPhysicalLookupJoin.scala:120)
        at 
org.apache.flink.table.planner.plan.nodes.physical.common.CommonPhysicalLookupJoin.isAsyncEnabled(CommonPhysicalLookupJoin.scala:116)
        at 
org.apache.flink.table.planner.plan.nodes.physical.common.CommonPhysicalLookupJoin.asyncOptions$lzycompute(CommonPhysicalLookupJoin.scala:129)
        at 
org.apache.flink.table.planner.plan.nodes.physical.common.CommonPhysicalLookupJoin.asyncOptions(CommonPhysicalLookupJoin.scala:129)
   ```



-- 
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.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to