This is an automated email from the ASF dual-hosted git repository. zykkk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new d11e66efb6e [improvement](catalog) fix jdbc mysql catalog to_date fun pushdown (#29900) d11e66efb6e is described below commit d11e66efb6ed962f019079edf91c7b4c0c751031 Author: zy-kkk <zhongy...@gmail.com> AuthorDate: Tue Jan 16 15:54:52 2024 +0800 [improvement](catalog) fix jdbc mysql catalog to_date fun pushdown (#29900) --- .../doris/planner/external/jdbc/JdbcFunctionPushDownRule.java | 1 + .../data/external_table_p0/jdbc/test_mysql_jdbc_catalog.out | 6 ++++++ .../suites/external_table_p0/jdbc/test_mysql_jdbc_catalog.groovy | 6 ++++++ 3 files changed, 13 insertions(+) diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/external/jdbc/JdbcFunctionPushDownRule.java b/fe/fe-core/src/main/java/org/apache/doris/planner/external/jdbc/JdbcFunctionPushDownRule.java index 27fd693ca4d..4fb8788bb0b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/external/jdbc/JdbcFunctionPushDownRule.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/external/jdbc/JdbcFunctionPushDownRule.java @@ -62,6 +62,7 @@ public class JdbcFunctionPushDownRule { static { REPLACE_MYSQL_FUNCTIONS.put("nvl", "ifnull"); + REPLACE_MYSQL_FUNCTIONS.put("to_date", "date"); } private static boolean isReplaceMysqlFunctions(String functionName) { diff --git a/regression-test/data/external_table_p0/jdbc/test_mysql_jdbc_catalog.out b/regression-test/data/external_table_p0/jdbc/test_mysql_jdbc_catalog.out index 4a7c9a9035d..96710f09e36 100644 --- a/regression-test/data/external_table_p0/jdbc/test_mysql_jdbc_catalog.out +++ b/regression-test/data/external_table_p0/jdbc/test_mysql_jdbc_catalog.out @@ -185,6 +185,12 @@ bca 2022-11-02 2022-11-02 8012 vivo -- !ex_tb21_6 -- 1 1 +-- !ex_tb21_7 -- +2 1 + +-- !ex_tb21_8 -- +2 2 + -- !information_schema -- character_sets collations diff --git a/regression-test/suites/external_table_p0/jdbc/test_mysql_jdbc_catalog.groovy b/regression-test/suites/external_table_p0/jdbc/test_mysql_jdbc_catalog.groovy index ec09d2a319d..fdc1f84e382 100644 --- a/regression-test/suites/external_table_p0/jdbc/test_mysql_jdbc_catalog.groovy +++ b/regression-test/suites/external_table_p0/jdbc/test_mysql_jdbc_catalog.groovy @@ -172,6 +172,8 @@ suite("test_mysql_jdbc_catalog", "p0,external,mysql,external_docker,external_doc order_qt_ex_tb21_4 """ select `key`, `id` from ${ex_tb21} where abs(`key`) = 2 order by id;""" order_qt_ex_tb21_5 """ select `key`, `id` from ${ex_tb21} where `key` between 1 and 2 order by id;""" order_qt_ex_tb21_6 """ select `key`, `id` from ${ex_tb21} where `key` = case when id = 1 then 1 else 0 end order by id;""" + order_qt_ex_tb21_7 """ select (`key` +1) as k, `id` from ${ex_tb21} having abs(k) = 2 order by id;""" + order_qt_ex_tb21_8 """ select `key` as k, `id` from ${ex_tb21} having abs(k) = 2 order by id;""" order_qt_information_schema """ show tables from information_schema; """ order_qt_auto_default_t """insert into ${auto_default_t}(name) values('a'); """ order_qt_dt """select * from ${dt}; """ @@ -179,6 +181,10 @@ suite("test_mysql_jdbc_catalog", "p0,external,mysql,external_docker,external_doc order_qt_test_dz """select * from ${test_zd} order by 1; """ order_qt_test_filter_not """select * from ${ex_tb13} where name not like '%张三0%' order by 1; """ order_qt_test_filter_not_old_plan """select /*+ SET_VAR(enable_nereids_planner=false) */ * from ${ex_tb13} where name not like '%张三0%' order by 1; """ + explain { + sql("select `datetime` from all_types where to_date(`datetime`) = '2012-10-25';") + contains """ SELECT `datetime` FROM `doris_test`.`all_types` WHERE (date(`datetime`) = '2012-10-25')""" + } // test insert String uuid1 = UUID.randomUUID().toString(); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org