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


##########
flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcDynamicTableSourceITCase.java:
##########
@@ -356,6 +403,168 @@ void testLookupJoin(Caching caching) {
         }
     }
 
+    @ParameterizedTest
+    @EnumSource(Caching.class)
+    void testLookupJoinWithFilter(Caching caching) {
+        Collection<Row> dataToRegister =
+                Arrays.asList(
+                        Row.of(1L, "Alice"),
+                        Row.of(1L, "Alice"),
+                        Row.of(2L, "Bob"),
+                        Row.of(3L, "Charlie"));
+        String createTableStatement =
+                "CREATE TABLE value_source ( "
+                        + " `id` BIGINT, "
+                        + " `name` STRING, "
+                        + " `proctime` AS PROCTIME()"
+                        + ") WITH ("
+                        + " 'connector' = 'values', "
+                        + " 'data-id' = '%s'"
+                        + ")";
+
+        String selectStatement =
+                "SELECT S.id, S.name, D.id, D.timestamp6_col, D.decimal_col 
FROM value_source"
+                        + " AS S JOIN jdbc_lookup for system_time as of 
S.proctime AS D ON "
+                        + "S.id = D.id AND S.name = \'Bob\'";
+
+        List<Row> expectedResultSetRows =
+                Arrays.asList(
+                        Row.of(
+                                2L,
+                                "Bob",
+                                2L,
+                                
truncateTime(LocalDateTime.parse("2020-01-01T15:36:01.123456")),
+                                BigDecimal.valueOf(101.1234)));
+
+        RowData key2 = GenericRowData.of(2L);
+        RowData value2 =
+                GenericRowData.of(
+                        2L,
+                        
DecimalData.fromBigDecimal(BigDecimal.valueOf(101.1234), 10, 4),
+                        TimestampData.fromLocalDateTime(
+                                
truncateTime(LocalDateTime.parse("2020-01-01T15:36:01.123456"))));
+
+        Map<RowData, Collection<RowData>> expectedCachedEntries = new 
HashMap<>();
+        expectedCachedEntries.put(key2, Collections.singletonList(value2));
+
+        lookupTableTest(
+                caching,
+                dataToRegister,
+                createTableStatement,
+                selectStatement,
+                expectedResultSetRows,
+                expectedCachedEntries);
+    }
+
+    @ParameterizedTest
+    @EnumSource(Caching.class)
+    void testLookupJoinWithMultipleFilters(Caching caching) {
+        Collection<Row> dataToRegister =
+                Arrays.asList(
+                        Row.of(1L, "Alice", "ABC"),
+                        Row.of(1L, "Alice", "ADD"),
+                        Row.of(2L, "Bob", "BGH"),
+                        Row.of(3L, "Charlie", "CHJ"));
+
+        String createTableStatement =
+                "CREATE TABLE value_source ( "
+                        + " `id` BIGINT, "
+                        + " `name` STRING, "
+                        + " `nickname` STRING, "
+                        + " `proctime` AS PROCTIME()"
+                        + ") WITH ("
+                        + " 'connector' = 'values', "
+                        + " 'data-id' = '%s'"
+                        + ")";
+        String selectStatement =
+                "SELECT S.id, S.name, S.nickname, D.id, D.timestamp6_col, 
D.decimal_col FROM value_source"
+                        + " AS S JOIN jdbc_lookup for system_time as of 
S.proctime AS D ON "
+                        + "S.id = D.id AND S.name = \'Alice\' AND S.nickname = 
\'ADD\'";

Review Comment:
   nit: why do we need such escaping here?
   IMHO it makes it more complex to read



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