From 2011074b519a598a59fba57edffbe8b37bcefd64 Mon Sep 17 00:00:00 2001 From: zy-kkk Date: Thu, 28 Nov 2024 23:49:29 +0800 Subject: [PATCH] [fix](jdbc catalog) set `enable_jdbc_cast_predicate_push_down` default true (#44548) ### What problem does this PR solve? Related PR: #42102 Problem Summary: We found that after disabling pushdown of predicates with implicit casts, some users experienced slower queries, so we temporarily changed this parameter back to the default behavior. --- .../src/main/java/org/apache/doris/qe/SessionVariable.java | 2 +- .../jdbc/test_clickhouse_jdbc_catalog.groovy | 6 ------ .../jdbc/test_jdbc_catalog_push_cast.groovy | 2 ++ 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java index f3e6eea675699a..48e18978d7202b 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java @@ -686,7 +686,7 @@ public class SessionVariable implements Serializable, Writable { @VariableMgr.VarAttr(name = ENABLE_JDBC_CAST_PREDICATE_PUSH_DOWN, needForward = true, description = {"是否允许将带有 CAST 表达式的谓词下推到 JDBC 外部表。", "Whether to allow predicates with CAST expressions to be pushed down to JDBC external tables."}) - public boolean enableJdbcCastPredicatePushDown = false; + public boolean enableJdbcCastPredicatePushDown = true; @VariableMgr.VarAttr(name = ROUND_PRECISE_DECIMALV2_VALUE) public boolean roundPreciseDecimalV2Value = false; diff --git a/regression-test/suites/external_table_p0/jdbc/test_clickhouse_jdbc_catalog.groovy b/regression-test/suites/external_table_p0/jdbc/test_clickhouse_jdbc_catalog.groovy index 23e37184feb7c0..2b427e2eec2601 100644 --- a/regression-test/suites/external_table_p0/jdbc/test_clickhouse_jdbc_catalog.groovy +++ b/regression-test/suites/external_table_p0/jdbc/test_clickhouse_jdbc_catalog.groovy @@ -82,17 +82,11 @@ suite("test_clickhouse_jdbc_catalog", "p0,external,clickhouse,external_docker,ex sql("select * from ts where from_unixtime(ts,'yyyyMMdd') >= '2022-01-01';") contains """QUERY: SELECT "id", "ts" FROM "doris_test"."ts" WHERE ((FROM_UNIXTIME("ts", '%Y%m%d') >= '2022-01-01'))""" } - explain { - sql("select * from ts where nvl(ts,null) >= '1';") - contains """QUERY: SELECT "id", "ts" FROM "doris_test"."ts""" - } order_qt_func_push2 """select * from ts where ts <= unix_timestamp(from_unixtime(ts,'yyyyMMdd'));""" - sql "set enable_jdbc_cast_predicate_push_down = true;" explain { sql("select * from ts where ts <= unix_timestamp(from_unixtime(ts,'yyyy-MM-dd'));") contains """QUERY: SELECT "id", "ts" FROM "doris_test"."ts" WHERE (("ts" <= toUnixTimestamp(FROM_UNIXTIME("ts", '%Y-%m-%d'))))""" } - sql "set enable_jdbc_cast_predicate_push_down = false;" order_qt_dt_with_tz """ select * from dt_with_tz order by id; """ diff --git a/regression-test/suites/external_table_p0/jdbc/test_jdbc_catalog_push_cast.groovy b/regression-test/suites/external_table_p0/jdbc/test_jdbc_catalog_push_cast.groovy index 6271a1619a5fac..3585f5fbb50941 100644 --- a/regression-test/suites/external_table_p0/jdbc/test_jdbc_catalog_push_cast.groovy +++ b/regression-test/suites/external_table_p0/jdbc/test_jdbc_catalog_push_cast.groovy @@ -34,6 +34,8 @@ suite("test_jdbc_catalog_push_cast", "p0,external,mysql,external_docker,external "driver_class" = "com.mysql.cj.jdbc.Driver" );""" + sql "set enable_jdbc_cast_predicate_push_down = false;" + sql "use jdbc_catalog_push_cast.doris_test" qt_sql """select * from test_cast where date(datetime_c) = '2022-01-01';"""