This is an automated email from the ASF dual-hosted git repository.
morningman pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new b0e24611810 [branch-2.1][improvement](JdbcScan) Change the mysql
function that does not support pushdown in JdbcScan to Config (#35631)
b0e24611810 is described below
commit b0e24611810e0eb5441bf6542cb33cd81c45a19f
Author: zy-kkk <[email protected]>
AuthorDate: Thu May 30 15:40:08 2024 +0800
[branch-2.1][improvement](JdbcScan) Change the mysql function that does not
support pushdown in JdbcScan to Config (#35631)
pk #35196
---
fe/fe-common/src/main/java/org/apache/doris/common/Config.java | 4 ++++
.../doris/datasource/jdbc/source/JdbcFunctionPushDownRule.java | 4 ++++
.../suites/external_table_p0/jdbc/test_mysql_jdbc_catalog.groovy | 5 +++++
3 files changed, 13 insertions(+)
diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
index 68548e3884d..7a921d9214a 100644
--- a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
+++ b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java
@@ -151,6 +151,10 @@ public class Config extends ConfigBase {
+ "The default is * to allow all, if set to empty, all are
not allowed"})
public static String jdbc_driver_secure_path = "*";
+ @ConfField(description = {"MySQL Jdbc Catalog mysql 不支持下推的函数",
+ "MySQL Jdbc Catalog mysql does not support pushdown functions"})
+ public static String[] jdbc_mysql_unsupported_pushdown_functions =
{"date_trunc", "money_format", "negative"};
+
@ConfField(mutable = true, masterOnly = true, description = {"broker load
时,单个节点上 load 执行计划的默认并行度",
"The default parallelism of the load execution plan on a single
node when the broker load is submitted"})
public static int default_load_parallelism = 8;
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/source/JdbcFunctionPushDownRule.java
b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/source/JdbcFunctionPushDownRule.java
index 13c0d474eee..a765681c402 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/source/JdbcFunctionPushDownRule.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/datasource/jdbc/source/JdbcFunctionPushDownRule.java
@@ -22,6 +22,7 @@ import org.apache.doris.analysis.FunctionCallExpr;
import org.apache.doris.analysis.FunctionName;
import org.apache.doris.analysis.TimestampArithmeticExpr;
import org.apache.doris.catalog.TableIf.TableType;
+import org.apache.doris.common.Config;
import org.apache.doris.thrift.TOdbcTableType;
import com.google.common.base.Preconditions;
@@ -29,6 +30,7 @@ import com.google.common.collect.Maps;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
+import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.TreeSet;
@@ -41,6 +43,8 @@ public class JdbcFunctionPushDownRule {
static {
MYSQL_UNSUPPORTED_FUNCTIONS.add("date_trunc");
MYSQL_UNSUPPORTED_FUNCTIONS.add("money_format");
+ MYSQL_UNSUPPORTED_FUNCTIONS.add("negative");
+
MYSQL_UNSUPPORTED_FUNCTIONS.addAll(Arrays.asList(Config.jdbc_mysql_unsupported_pushdown_functions));
}
private static final TreeSet<String> CLICKHOUSE_SUPPORTED_FUNCTIONS = new
TreeSet<>(String.CASE_INSENSITIVE_ORDER);
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 906e2ff93d0..f74151e07ff 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
@@ -386,6 +386,11 @@ suite("test_mysql_jdbc_catalog",
"p0,external,mysql,external_docker,external_doc
contains "QUERY: SELECT `k8` FROM `doris_test`.`test1`"
}
+ explain {
+ sql("select k12 from test1 where negative(k12) = 1;")
+
+ contains "QUERY: SELECT `k12` FROM `doris_test`.`test1`"
+ }
explain {
sql ("SELECT timestamp0 from dt where
DATE_TRUNC(date_sub(timestamp0,INTERVAL 9 HOUR),'hour') > '2011-03-03
17:39:05';")
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]