kramerul commented on code in PR #3562:
URL: https://github.com/apache/calcite/pull/3562#discussion_r1923161375


##########
core/src/test/java/org/apache/calcite/test/JdbcAdapterTest.java:
##########
@@ -1424,6 +1430,57 @@ private LockWrapper exclusiveCleanDb(Connection c) 
throws SQLException {
             + "GROUP BY \"t2\".\"DNAME\", \"t2\".\"DNAME0\"")
         .runs();
   }
+
+  /**
+   * Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-4188";>[CALCITE-4188]
+   * Support EnumerableBatchNestedLoopJoin for JDBC</a>. */
+  @Test void testBatchNestedLoopJoinPlan() {
+    final String sql = "SELECT *\n"
+        + "FROM \"s\".\"emps\" A\n"
+        + "LEFT OUTER JOIN \"foodmart\".\"store\" B ON A.\"empid\" = 
B.\"store_id\"";
+    final String explain = "JdbcFilter(condition=[OR(=($cor0.empid0, $0), 
=($cor1.empid0, $0)";
+    final String jdbcSql = "SELECT *\n"
+        + "FROM \"foodmart\".\"store\"\n"
+        + "WHERE ? = \"store_id\" OR (? = \"store_id\" OR ? = \"store_id\") OR 
(? = \"store_id\" OR"
+        + " (? = \"store_id\" OR ? = \"store_id\")) OR (? = \"store_id\" OR (? 
= \"store_id\" OR ? "

Review Comment:
   This is caused by the configured batch size (100) of the batch nested loop 
join.
   The batch nested loop join reads 100 entries of the left side and than tries 
to read the matching 100 entries from the right side. If there are less then 
100 entries on the right side, the conditions in this query are filled with the 
last existing one from the right side.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to