snuyanzin commented on code in PR #79: URL: https://github.com/apache/flink-connector-jdbc/pull/79#discussion_r1463158838
########## flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcRowDataLookupFunctionTest.java: ########## @@ -82,6 +103,114 @@ void testLookup(boolean withFailure) throws Exception { assertThat(result).isEqualTo(expected); } + @ParameterizedTest + @MethodSource("lookupWithPredicatesProvider") + void testEval(TestSpec testSpec) throws Exception { + JdbcRowDataLookupFunction lookupFunction = + buildRowDataLookupFunctionWithPredicates( + testSpec.withFailure, testSpec.resolvedPredicates, testSpec.pushdownParams); + + ListOutputCollector collector = new ListOutputCollector(); + lookupFunction.setCollector(collector); + lookupFunction.open(null); + lookupFunction.eval(testSpec.keys); + + if (testSpec.withFailure) { + // Close connection here, and this will be recovered by retry + if (lookupFunction.getDbConnection() != null) { + lookupFunction.getDbConnection().close(); + } + } + + List<String> result = + new ArrayList<>(collector.getOutputs()) + .stream().map(RowData::toString).sorted().collect(Collectors.toList()); + Collections.sort(testSpec.expected); + assertThat(result).isEqualTo(testSpec.expected); + } + + private static class TestSpec { Review Comment: This class should have `toString()` otherwise it is impossible to navigate between different tests involving this as a parameter -- 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