[improvement](catalog) Change the push-down parameters of the predicate function of the table query SQL into variables (#30028)
In this PR, we will control whether the external data source query is a push-down function parameter in the filter condition, changing the enable_fun_pushdown of fe conf to the enable_ext_func_pred_pushdown of the variable
This commit is contained in:
@ -37,7 +37,6 @@ import org.apache.doris.catalog.TableIf;
|
||||
import org.apache.doris.catalog.TableIf.TableType;
|
||||
import org.apache.doris.catalog.external.JdbcExternalTable;
|
||||
import org.apache.doris.common.AnalysisException;
|
||||
import org.apache.doris.common.Config;
|
||||
import org.apache.doris.common.UserException;
|
||||
import org.apache.doris.nereids.glue.translator.PlanTranslatorContext;
|
||||
import org.apache.doris.planner.PlanNodeId;
|
||||
@ -223,6 +222,7 @@ public class JdbcScanNode extends ExternalScanNode {
|
||||
}
|
||||
|
||||
if (jdbcType == TOdbcTableType.CLICKHOUSE
|
||||
&& ConnectContext.get() != null
|
||||
&& ConnectContext.get().getSessionVariable().jdbcClickhouseQueryFinal) {
|
||||
sql.append(" SETTINGS final = 1");
|
||||
}
|
||||
@ -313,7 +313,11 @@ public class JdbcScanNode extends ExternalScanNode {
|
||||
if (containsFunctionCallExpr(expr)) {
|
||||
if (tableType.equals(TOdbcTableType.MYSQL) || tableType.equals(TOdbcTableType.CLICKHOUSE)
|
||||
|| tableType.equals(TOdbcTableType.ORACLE)) {
|
||||
return Config.enable_func_pushdown;
|
||||
if (ConnectContext.get() != null) {
|
||||
return ConnectContext.get().getSessionVariable().enableExtFuncPredPushdown;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -30,7 +30,6 @@ import org.apache.doris.catalog.Env;
|
||||
import org.apache.doris.catalog.JdbcTable;
|
||||
import org.apache.doris.catalog.OdbcTable;
|
||||
import org.apache.doris.common.AnalysisException;
|
||||
import org.apache.doris.common.Config;
|
||||
import org.apache.doris.common.UserException;
|
||||
import org.apache.doris.nereids.glue.translator.PlanTranslatorContext;
|
||||
import org.apache.doris.planner.PlanNodeId;
|
||||
@ -267,6 +266,10 @@ public class OdbcScanNode extends ExternalScanNode {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return Config.enable_func_pushdown;
|
||||
if (ConnectContext.get() != null) {
|
||||
return ConnectContext.get().getSessionVariable().enableExtFuncPredPushdown;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -302,6 +302,8 @@ public class SessionVariable implements Serializable, Writable {
|
||||
|
||||
public static final String ENABLE_FUNCTION_PUSHDOWN = "enable_function_pushdown";
|
||||
|
||||
public static final String ENABLE_EXT_FUNC_PRED_PUSHDOWN = "enable_ext_func_pred_pushdown";
|
||||
|
||||
public static final String ENABLE_COMMON_EXPR_PUSHDOWN = "enable_common_expr_pushdown";
|
||||
|
||||
public static final String FRAGMENT_TRANSMISSION_COMPRESSION_CODEC = "fragment_transmission_compression_codec";
|
||||
@ -524,7 +526,9 @@ public class SessionVariable implements Serializable, Writable {
|
||||
@VariableMgr.VarAttr(name = EXPAND_RUNTIME_FILTER_BY_INNER_JION)
|
||||
public boolean expandRuntimeFilterByInnerJoin = true;
|
||||
|
||||
@VariableMgr.VarAttr(name = JDBC_CLICKHOUSE_QUERY_FINAL)
|
||||
@VariableMgr.VarAttr(name = JDBC_CLICKHOUSE_QUERY_FINAL, needForward = true,
|
||||
description = {"是否在查询 ClickHouse JDBC 外部表时,对查询 SQL 添加 FINAL 关键字。",
|
||||
"Whether to add the FINAL keyword to the query SQL when querying ClickHouse JDBC external tables."})
|
||||
public boolean jdbcClickhouseQueryFinal = false;
|
||||
|
||||
@VariableMgr.VarAttr(name = ROUND_PRECISE_DECIMALV2_VALUE)
|
||||
@ -1090,6 +1094,12 @@ public class SessionVariable implements Serializable, Writable {
|
||||
@VariableMgr.VarAttr(name = ENABLE_FUNCTION_PUSHDOWN, fuzzy = true)
|
||||
public boolean enableFunctionPushdown = false;
|
||||
|
||||
@VariableMgr.VarAttr(name = ENABLE_EXT_FUNC_PRED_PUSHDOWN, needForward = true,
|
||||
description = {"启用外部表(如通过ODBC或JDBC访问的表)查询中谓词的函数下推",
|
||||
"Enable function pushdown for predicates in queries to external tables "
|
||||
+ "(such as tables accessed via ODBC or JDBC)"})
|
||||
public boolean enableExtFuncPredPushdown = true;
|
||||
|
||||
@VariableMgr.VarAttr(name = FORBID_UNKNOWN_COLUMN_STATS)
|
||||
public boolean forbidUnknownColStats = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user