From d5105f1475915bda76e11ad038cc7338b6d1e134 Mon Sep 17 00:00:00 2001 From: DengzhiLiu Date: Wed, 7 Feb 2024 04:44:04 +0000 Subject: [PATCH] Make white filter compat with former --- src/sql/code_generator/ob_static_engine_cg.h | 2 +- src/sql/engine/basic/ob_pushdown_filter.cpp | 40 ++++++++++++++------ 2 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/sql/code_generator/ob_static_engine_cg.h b/src/sql/code_generator/ob_static_engine_cg.h index 7d51c2013e..d1d4795d45 100644 --- a/src/sql/code_generator/ob_static_engine_cg.h +++ b/src/sql/code_generator/ob_static_engine_cg.h @@ -184,6 +184,7 @@ public: bool is_root_job = true); inline static void exprs_not_support_vectorize(const ObIArray &exprs, bool &found); + inline uint64_t get_cur_cluster_version() { return cur_cluster_version_; } // detect physical operator type from logic operator. static int get_phy_op_type(ObLogicalOperator &op, ObPhyOperatorType &type, @@ -507,7 +508,6 @@ private: || T_FUN_SUM == expr_type || T_FUN_MAX == expr_type || T_FUN_MIN == expr_type; } - uint64_t get_cur_cluster_version() { return cur_cluster_version_; } int check_fk_nested_dup_del(const uint64_t table_id, const uint64_t root_table_id, DASTableIdList &parent_tables, diff --git a/src/sql/engine/basic/ob_pushdown_filter.cpp b/src/sql/engine/basic/ob_pushdown_filter.cpp index 6de191546f..8740bc7cb1 100644 --- a/src/sql/engine/basic/ob_pushdown_filter.cpp +++ b/src/sql/engine/basic/ob_pushdown_filter.cpp @@ -261,17 +261,35 @@ int ObPushdownFilterConstructor::is_white_mode(const ObRawExpr* raw_expr, bool & } need_check = false; } else { - const ObExprResType &col_type = child->get_result_type(); - for (int64_t i = 1; OB_SUCC(ret) && need_check && i < raw_expr->get_param_count(); i++) { - if (OB_ISNULL(child = raw_expr->get_param_expr(i))) { - ret = OB_ERR_UNEXPECTED; - LOG_WARN("Unexpected null child expr", K(ret), K(i)); - } else { - const ObExprResType ¶m_type = child->get_result_type(); - need_check = child->is_const_expr(); - if (need_check && !param_type.is_null()) { - const ObCmpOp cmp_op = sql::ObRelationalExprOperator::get_cmp_op(raw_expr->get_expr_type()); - need_check = sql::ObRelationalExprOperator::can_cmp_without_cast(col_type, param_type, cmp_op); + if (static_cg_.get_cur_cluster_version() < CLUSTER_VERSION_4_3_0_0) { + const ObObjMeta &col_meta = child->get_result_meta(); + for (int64_t i = 1; OB_SUCC(ret) && need_check && i < raw_expr->get_param_count(); i++) { + if (OB_ISNULL(child = raw_expr->get_param_expr(i))) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("Unexpected null child expr", K(ret), K(i)); + } else { + const ObObjMeta ¶m_meta = child->get_result_meta(); + need_check = child->is_const_expr(); + if (need_check && !param_meta.is_null()) { + const ObCmpOp cmp_op = sql::ObRelationalExprOperator::get_cmp_op(raw_expr->get_expr_type()); + obj_cmp_func cmp_func = nullptr; + need_check = ObObjCmpFuncs::can_cmp_without_cast(col_meta, param_meta, cmp_op, cmp_func); + } + } + } + } else { + const ObExprResType &col_type = child->get_result_type(); + for (int64_t i = 1; OB_SUCC(ret) && need_check && i < raw_expr->get_param_count(); i++) { + if (OB_ISNULL(child = raw_expr->get_param_expr(i))) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("Unexpected null child expr", K(ret), K(i)); + } else { + const ObExprResType ¶m_type = child->get_result_type(); + need_check = child->is_const_expr(); + if (need_check && !param_type.is_null()) { + const ObCmpOp cmp_op = sql::ObRelationalExprOperator::get_cmp_op(raw_expr->get_expr_type()); + need_check = sql::ObRelationalExprOperator::can_cmp_without_cast(col_type, param_type, cmp_op); + } } } }