This is an automated email from the ASF dual-hosted git repository. libenchao pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/flink-connector-jdbc.git
The following commit(s) were added to refs/heads/main by this push: new aa75d64 [FLINK-31181] Support LIKE operator pushdown aa75d64 is described below commit aa75d6476a381c4c80bb39364944891c514b8002 Author: Grzegorz KoĊakowski <grzegorz.kolakow...@getindata.com> AuthorDate: Wed Feb 22 09:44:11 2023 +0100 [FLINK-31181] Support LIKE operator pushdown --- .../jdbc/table/JdbcFilterPushdownPreparedStatementVisitor.java | 3 +++ .../jdbc/table/JdbcFilterPushdownPreparedStatementVisitorTest.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/table/JdbcFilterPushdownPreparedStatementVisitor.java b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/table/JdbcFilterPushdownPreparedStatementVisitor.java index f9622a8..a4e31ee 100644 --- a/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/table/JdbcFilterPushdownPreparedStatementVisitor.java +++ b/flink-connector-jdbc/src/main/java/org/apache/flink/connector/jdbc/table/JdbcFilterPushdownPreparedStatementVisitor.java @@ -79,6 +79,9 @@ public class JdbcFilterPushdownPreparedStatementVisitor if (BuiltInFunctionDefinitions.AND.equals(call.getFunctionDefinition())) { return renderBinaryOperator("AND", call.getResolvedChildren()); } + if (BuiltInFunctionDefinitions.LIKE.equals(call.getFunctionDefinition())) { + return renderBinaryOperator("LIKE", call.getResolvedChildren()); + } if (BuiltInFunctionDefinitions.IS_NULL.equals(call.getFunctionDefinition())) { return renderUnaryOperator("IS NULL", call.getResolvedChildren().get(0), true); } diff --git a/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcFilterPushdownPreparedStatementVisitorTest.java b/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcFilterPushdownPreparedStatementVisitorTest.java index 8bdfc67..57a9e0d 100644 --- a/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcFilterPushdownPreparedStatementVisitorTest.java +++ b/flink-connector-jdbc/src/test/java/org/apache/flink/connector/jdbc/table/JdbcFilterPushdownPreparedStatementVisitorTest.java @@ -144,7 +144,8 @@ class JdbcFilterPushdownPreparedStatementVisitorTest { new Object[] {"real_col > 0.5", "real_col > ?", new BigDecimal("0.5")}, new Object[] { "double_col <= -0.3", "double_col <= ?", new BigDecimal("-0.3") - }) + }, + new Object[] {"description LIKE '_bcd%'", "description LIKE ?", "_bcd%"}) .forEach( inputs -> assertSimpleInputExprEqualsOutExpr(