diff --git a/src/sql/engine/expr/ob_expr_operator.cpp b/src/sql/engine/expr/ob_expr_operator.cpp index 76abd7413d..d8fc07b3d8 100644 --- a/src/sql/engine/expr/ob_expr_operator.cpp +++ b/src/sql/engine/expr/ob_expr_operator.cpp @@ -2119,14 +2119,52 @@ int ObRelationalExprOperator::deduce_cmp_type(const ObExprOperator &expr, ObExprOperator::calc_result_flag2(type, type1, type2); bool need_no_cast = can_cmp_without_cast( type1, type2, get_cmp_op(expr.get_type()), *type_ctx.get_session()); - type1.set_calc_type(need_no_cast ? type1.get_type() : cmp_type.get_calc_type()); - type2.set_calc_type(need_no_cast ? type2.get_type() : cmp_type.get_calc_type()); - if (ob_is_string_or_lob_type(cmp_type.get_calc_type())) { - type1.set_calc_collation_type(cmp_type.get_calc_collation_type()); - type2.set_calc_collation_type(cmp_type.get_calc_collation_type()); - } else if (ObRawType == cmp_type.get_calc_type()) { - type1.set_calc_collation_type(CS_TYPE_BINARY); - type2.set_calc_collation_type(CS_TYPE_BINARY); + if (!need_no_cast && is_mysql_mode()) { + // to be compatiable with mysql: + // if c1 is date or datetime, convert 'c1 = c2+1'to cast (c1 as double) = cast (c2+1 as double) + const ObRawExpr* cmp_expr = type_ctx.get_raw_expr(); + const ObRawExpr* date_expr = cmp_expr->get_param_expr(0); + const ObRawExpr* other_expr = cmp_expr->get_param_expr(1); + ObObjType other_expr_type = ObMaxType; + bool is_date_op_other = false; + if (OB_ISNULL(cmp_expr) || OB_ISNULL(date_expr) || OB_ISNULL(other_expr)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("unexpected null", K(ret), K(cmp_expr)); + } else if (date_expr->get_result_type().get_type() == ObDateType || + date_expr->get_result_type().get_type() == ObDateTimeType) { + other_expr_type = other_expr->get_result_type().get_type(); + is_date_op_other = true; + } else if (other_expr->get_result_type().get_type() == ObDateType || + other_expr->get_result_type().get_type() == ObDateTimeType) { + const ObRawExpr *tmp_expr = date_expr; + date_expr = other_expr; + other_expr = tmp_expr; + other_expr_type = other_expr->get_result_type().get_type(); + is_date_op_other = true; + } else { + //do nothing + } + + if (OB_SUCC(ret) && + is_mysql_mode() && + is_date_op_other && + (ob_is_accurate_numeric_type(other_expr_type) || ob_is_real_type(other_expr_type)) && + !(other_expr->is_const_expr() && !date_expr->is_const_expr())) { + cmp_type.set_calc_type(ObDoubleType); + type.set_calc_collation(cmp_type); + type.set_calc_type(cmp_type.get_calc_type()); + } + } + if (OB_SUCC(ret)) { + type1.set_calc_type(need_no_cast ? type1.get_type() : cmp_type.get_calc_type()); + type2.set_calc_type(need_no_cast ? type2.get_type() : cmp_type.get_calc_type()); + if (ob_is_string_or_lob_type(cmp_type.get_calc_type())) { + type1.set_calc_collation_type(cmp_type.get_calc_collation_type()); + type2.set_calc_collation_type(cmp_type.get_calc_collation_type()); + } else if (ObRawType == cmp_type.get_calc_type()) { + type1.set_calc_collation_type(CS_TYPE_BINARY); + type2.set_calc_collation_type(CS_TYPE_BINARY); + } } } return ret; diff --git a/src/sql/resolver/dml/ob_select_resolver.cpp b/src/sql/resolver/dml/ob_select_resolver.cpp index 801cfe8d42..81a78cc97a 100644 --- a/src/sql/resolver/dml/ob_select_resolver.cpp +++ b/src/sql/resolver/dml/ob_select_resolver.cpp @@ -856,13 +856,34 @@ int ObSelectResolver::check_group_by() // 1. select item/having/order item中的表达式树(子树)需要每个都在group by列中找到 // 2. 递归查找是否在groupby列中,将在groupby的列的指针替换。 if (OB_SUCC(ret)) { - if (ObTransformUtils::replace_stmt_expr_with_groupby_exprs(select_stmt)) { + if (OB_FAIL(replace_stmt_expr_with_groupby_exprs(select_stmt, params_.query_ctx_))) { LOG_WARN("failed to replace stmt expr with groupby columns", K(ret)); } } return ret; } +int ObSelectResolver::replace_stmt_expr_with_groupby_exprs(ObSelectStmt *select_stmt, + ObQueryCtx *query_ctx) +{ + int ret = OB_SUCCESS; + ObSEArray pc_constraints; + ObSEArray eq_constraints; + if (OB_ISNULL(query_ctx)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("unexpected null", K(ret), K(query_ctx)); + } else if (OB_FAIL(ObTransformUtils::inner_replace_stmt_expr_with_groupby_exprs(select_stmt, params_.param_list_, pc_constraints, eq_constraints))) { + LOG_WARN("failed to replace stmt expr with groupby columns", K(ret)); + } else if (OB_FAIL(append_array_no_dup(query_ctx->all_plan_const_param_constraints_, pc_constraints))) { + LOG_WARN("failed to append const param info", K(ret)); + } else if (OB_FAIL(append_array_no_dup(query_ctx->all_possible_const_param_constraints_, pc_constraints))) { + LOG_WARN("failed to append const param info", K(ret)); + } else if (OB_FAIL(append_array_no_dup(query_ctx->all_equal_param_constraints_, eq_constraints))) { + LOG_WARN("failed to append const param info", K(ret)); + } + return ret; +} + // 1. lob type can't be ordered // 2. the order item should be exists in select items if has distinct int ObSelectResolver::check_order_by() diff --git a/src/sql/resolver/dml/ob_select_resolver.h b/src/sql/resolver/dml/ob_select_resolver.h index 71aea9443c..a48781f4cb 100644 --- a/src/sql/resolver/dml/ob_select_resolver.h +++ b/src/sql/resolver/dml/ob_select_resolver.h @@ -428,6 +428,8 @@ private: int add_name_for_anonymous_view(); int add_name_for_anonymous_view_recursive(TableItem *table_item); + int replace_stmt_expr_with_groupby_exprs(ObSelectStmt *select_stmt, ObQueryCtx *query_ctx); + protected: // data members /*these member is only for with clause*/ diff --git a/src/sql/rewrite/ob_transform_pre_process.cpp b/src/sql/rewrite/ob_transform_pre_process.cpp index bcf06fe32b..95e4cef1a4 100644 --- a/src/sql/rewrite/ob_transform_pre_process.cpp +++ b/src/sql/rewrite/ob_transform_pre_process.cpp @@ -1229,7 +1229,7 @@ int ObTransformPreProcess::create_set_view_stmt(ObSelectStmt *origin_stmt, 1 so that 1 in "select c1-1 from t1 group by grouping sets(c1,1);" share same expr. */ - if (OB_FAIL(ObTransformUtils::replace_stmt_expr_with_groupby_exprs(origin_stmt, ctx_))) { + if (OB_FAIL(ObTransformUtils::replace_stmt_expr_with_groupby_exprs(origin_stmt, ctx_, true))) { LOG_WARN("failed to replace stmt expr with groupby columns", K(ret)); } for (int64_t i = 0; OB_SUCC(ret) && i < count; i++) { @@ -1269,7 +1269,7 @@ int ObTransformPreProcess::create_set_view_stmt(ObSelectStmt *origin_stmt, groupby_stmt->get_window_func_exprs().reset(); ObSEArray old_exprs; ObSEArray new_exprs; - if (OB_FAIL(ObTransformUtils::replace_stmt_expr_with_groupby_exprs(groupby_stmt))) { + if (OB_FAIL(ObTransformUtils::replace_stmt_expr_with_groupby_exprs(groupby_stmt, ctx_))) { LOG_WARN("failed to replace stmt expr with groupby columns", K(ret)); } else if (OB_FAIL(create_select_list_from_grouping_sets(groupby_stmt, groupby_exprs_list, diff --git a/src/sql/rewrite/ob_transform_utils.cpp b/src/sql/rewrite/ob_transform_utils.cpp index fce9a7bc3c..fcde78d279 100644 --- a/src/sql/rewrite/ob_transform_utils.cpp +++ b/src/sql/rewrite/ob_transform_utils.cpp @@ -9116,7 +9116,7 @@ int ObTransformUtils::add_const_param_constraints(ObRawExpr *expr, } else { ObPCConstParamInfo param_info; ObObj target_obj; - ObConstRawExpr *const_expr = static_cast(params.at(0)); + ObConstRawExpr *const_expr = static_cast(params.at(i)); int64_t param_idx = const_expr->get_value().get_unknown(); if (OB_UNLIKELY(param_idx < 0 || param_idx >= plan_ctx->get_param_store().count())) { ret = OB_ERR_UNEXPECTED; @@ -9137,18 +9137,45 @@ int ObTransformUtils::add_const_param_constraints(ObRawExpr *expr, } int ObTransformUtils::replace_stmt_expr_with_groupby_exprs(ObSelectStmt *select_stmt, + ObTransformerCtx *trans_ctx, + bool need_check_add_expr) { + int ret = OB_SUCCESS; + ObPhysicalPlanCtx *plan_ctx = NULL; + ObSEArray pc_constraints; + ObSEArray eq_constraints; + if (OB_ISNULL(trans_ctx) || OB_ISNULL(trans_ctx->exec_ctx_) || OB_ISNULL(plan_ctx = trans_ctx->exec_ctx_->get_physical_plan_ctx())) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("get unexpected null", K(ret), K(trans_ctx), K(plan_ctx)); + } else if (OB_FAIL(inner_replace_stmt_expr_with_groupby_exprs(select_stmt, &plan_ctx->get_param_store(), pc_constraints, eq_constraints, need_check_add_expr ? trans_ctx : NULL))) { + LOG_WARN("fail to replace stmt expr with group by exprs", K(ret)); + } else if (OB_FAIL(append_array_no_dup(trans_ctx->plan_const_param_constraints_, pc_constraints))) { + LOG_WARN("failed to append const param info", K(ret)); + } else if (OB_FAIL(append_array_no_dup(trans_ctx->equal_param_constraints_, eq_constraints))) { + LOG_WARN("failed to append const param info", K(ret)); + } + return ret; +} + +//pc_constraints are for non-paramlized groupby exprs while eq_constraints are for paramlized groupby exprs +int ObTransformUtils::inner_replace_stmt_expr_with_groupby_exprs(ObSelectStmt *select_stmt, + const ParamStore *param_store, + ObIArray& pc_constraints, + ObIArray & eq_constraints, ObTransformerCtx *trans_ctx/*default null*/) { int ret = OB_SUCCESS; if (OB_ISNULL(select_stmt)) { ret = OB_ERR_UNEXPECTED; - LOG_WARN("get unexpected null", K(ret)); + LOG_WARN("get unexpected null", K(ret), K(select_stmt)); } else { common::ObIArray& select_items = select_stmt->get_select_items(); + ObSEArray param_expr_idxs; for (int64_t i = 0; OB_SUCC(ret) && i < select_items.count(); i++) { if (OB_FAIL(replace_with_groupby_exprs(select_stmt, select_items.at(i).expr_, true, + param_expr_idxs, + eq_constraints, trans_ctx))) { LOG_WARN("failed to replace with groupby columns.", K(ret)); } else { /*do nothing.*/ } @@ -9158,6 +9185,8 @@ int ObTransformUtils::replace_stmt_expr_with_groupby_exprs(ObSelectStmt *select_ if (OB_FAIL(replace_with_groupby_exprs(select_stmt, having_exprs.at(i), true, + param_expr_idxs, + eq_constraints, trans_ctx))) { LOG_WARN("failed to replace with groupby columns.", K(ret)); } else { /*do nothing.*/ } @@ -9167,10 +9196,35 @@ int ObTransformUtils::replace_stmt_expr_with_groupby_exprs(ObSelectStmt *select_ if (OB_FAIL(replace_with_groupby_exprs(select_stmt, order_items.at(i).expr_, false, + param_expr_idxs, + eq_constraints, trans_ctx))) { LOG_WARN("failed to replace with groupby columns.", K(ret)); } else { /*do nothing.*/ } } + if (OB_SUCC(ret) && param_expr_idxs.count() > 0) { + //build pc_constraints + if (OB_ISNULL(param_store)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("get unexpected null", K(ret), K(param_store)); + } else { + for (int64_t i = 0; OB_SUCC(ret) && i < param_expr_idxs.count(); i++) { + ObPCConstParamInfo const_param_info; + int64_t param_idx = param_expr_idxs.at(i); + if (OB_UNLIKELY(param_idx < 0 || param_idx >= param_store->count())) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("get unexpected error", K(ret), K(param_idx), + K(param_store->count())); + } else if (OB_FAIL(const_param_info.const_idx_.push_back(param_idx))) { + LOG_WARN("failed to push back param idx", K(ret)); + } else if (OB_FAIL(const_param_info.const_params_.push_back(param_store->at(param_idx)))) { + LOG_WARN("failed to push back value", K(ret)); + } else if (OB_FAIL(pc_constraints.push_back(const_param_info))) { + LOG_WARN("failed to push back param info", K(ret)); + } else {/*do nothing*/} + } + } + } } return ret; } @@ -9178,7 +9232,9 @@ int ObTransformUtils::replace_stmt_expr_with_groupby_exprs(ObSelectStmt *select_ int ObTransformUtils::replace_with_groupby_exprs(ObSelectStmt *select_stmt, ObRawExpr *&expr, bool need_query_compare, - ObTransformerCtx *trans_ctx/*default null*/, + ObIArray & param_expr_idxs, + ObIArray & eq_constraints, + ObTransformerCtx *trans_ctx, bool in_add_expr/*default false*/) { int ret = OB_SUCCESS; @@ -9186,6 +9242,8 @@ int ObTransformUtils::replace_with_groupby_exprs(ObSelectStmt *select_stmt, check_context.reset(); check_context.override_const_compare_ = true; check_context.override_query_compare_ = need_query_compare; + common::ObSEArray param_exprs_local; + common::ObSEArray equal_params_local; if (OB_ISNULL(expr) || OB_ISNULL(select_stmt) || OB_ISNULL(select_stmt->get_query_ctx())) { ret = OB_ERR_UNEXPECTED; LOG_WARN("got an unexpected null", K(ret)); @@ -9203,6 +9261,8 @@ int ObTransformUtils::replace_with_groupby_exprs(ObSelectStmt *select_stmt, if (OB_FAIL(SMART_CALL(replace_with_groupby_exprs(select_stmt, expr->get_param_expr(i), need_query_compare, + param_expr_idxs, + eq_constraints, trans_ctx, T_OP_ADD == expr->get_expr_type())))) { LOG_WARN("failed to replace with groupby columns.", K(ret)); @@ -9214,22 +9274,40 @@ int ObTransformUtils::replace_with_groupby_exprs(ObSelectStmt *select_stmt, ObIArray &grouping_sets_items = select_stmt->get_grouping_sets_items(); ObIArray &multi_rollup_items = select_stmt->get_multi_rollup_items(); for (int64_t i = 0; OB_SUCC(ret) && !is_existed && i < groupby_exprs.count(); i++) { + check_context.param_expr_.reset(); + check_context.equal_param_info_.reset(); if (OB_ISNULL(groupby_exprs.at(i))) { ret = OB_ERR_UNEXPECTED; LOG_WARN("got an unexpected null", K(ret)); } else if (groupby_exprs.at(i)->same_as(*expr, &check_context)) { - expr = groupby_exprs.at(i); - is_existed = true; + // add_var_to_array_no_dup + if (OB_FAIL(append(param_exprs_local, check_context.param_expr_))) { + LOG_WARN("fail to append param expr", K(ret)); + } else if (OB_FAIL(append(equal_params_local, check_context.equal_param_info_))) { + LOG_WARN("fail to append equal param info", K(ret)); + } else { + expr = groupby_exprs.at(i); + is_existed = true; + } } else { /*do nothing.*/ } + } for (int64_t i = 0; OB_SUCC(ret) && !is_existed && i < rollup_exprs.count(); i++) { + check_context.param_expr_.reset(); + check_context.equal_param_info_.reset(); if (OB_ISNULL(rollup_exprs.at(i))) { ret = OB_ERR_UNEXPECTED; LOG_WARN("got an unexpected null", K(ret)); } else if (rollup_exprs.at(i)->same_as(*expr, &check_context) && (lib::is_mysql_mode() || !expr->is_const_expr())) { - expr = rollup_exprs.at(i); - is_existed = true; + if (OB_FAIL(append(param_exprs_local, check_context.param_expr_))) { + LOG_WARN("fail to append param expr", K(ret)); + } else if (OB_FAIL(append(equal_params_local, check_context.equal_param_info_))) { + LOG_WARN("fail to append equal param info", K(ret)); + } else { + expr = rollup_exprs.at(i); + is_existed = true; + } } else { /*do nothing.*/ } } for (int64_t i = 0; OB_SUCC(ret) && !is_existed && i < grouping_sets_items.count(); i++) { @@ -9237,12 +9315,20 @@ int ObTransformUtils::replace_with_groupby_exprs(ObSelectStmt *select_stmt, for (int64_t j = 0; OB_SUCC(ret) && !is_existed && j < grouping_sets_exprs.count(); j++) { ObIArray &groupby_exprs = grouping_sets_exprs.at(j).groupby_exprs_; for (int64_t k = 0; OB_SUCC(ret) && !is_existed && k < groupby_exprs.count(); k++) { + check_context.param_expr_.reset(); + check_context.equal_param_info_.reset(); if (OB_ISNULL(groupby_exprs.at(k))) { ret = OB_ERR_UNEXPECTED; LOG_WARN("got an unexpected null", K(ret)); } else if (groupby_exprs.at(k)->same_as(*expr, &check_context)) { - expr = groupby_exprs.at(k); - is_existed = true; + if (OB_FAIL(append(param_exprs_local, check_context.param_expr_))) { + LOG_WARN("fail to append param expr", K(ret)); + } else if (OB_FAIL(append(equal_params_local, check_context.equal_param_info_))) { + LOG_WARN("fail to append equal param info", K(ret)); + } else { + expr = groupby_exprs.at(k); + is_existed = true; + } } else if (trans_ctx != NULL && in_add_expr && expr->get_expr_type() == T_QUESTIONMARK && groupby_exprs.at(k)->get_expr_type() == T_QUESTIONMARK && @@ -9258,6 +9344,7 @@ int ObTransformUtils::replace_with_groupby_exprs(ObSelectStmt *select_stmt, if (OB_FAIL(replace_add_exprs_with_groupby_exprs(expr, groupby_exprs.at(k), trans_ctx, + equal_params_local, is_existed))) { LOG_WARN("replace exprs in add failed", K(ret)); } @@ -9271,12 +9358,20 @@ int ObTransformUtils::replace_with_groupby_exprs(ObSelectStmt *select_stmt, for (int64_t k = 0; OB_SUCC(ret) && !is_existed && k < rollup_list_exprs.count(); k++) { ObIArray &groupby_exprs = rollup_list_exprs.at(k).groupby_exprs_; for (int64_t m = 0; OB_SUCC(ret) && !is_existed && m < groupby_exprs.count(); m++) { + check_context.param_expr_.reset(); + check_context.equal_param_info_.reset(); if (OB_ISNULL(groupby_exprs.at(m))) { ret = OB_ERR_UNEXPECTED; LOG_WARN("got an unexpected null", K(ret)); } else if (groupby_exprs.at(m)->same_as(*expr, &check_context)) { - expr = groupby_exprs.at(m); - is_existed = true; + if (OB_FAIL(append(param_exprs_local, check_context.param_expr_))) { + LOG_WARN("fail to append param expr", K(ret)); + } else if (OB_FAIL(append(equal_params_local, check_context.equal_param_info_))) { + LOG_WARN("fail to append equal param info", K(ret)); + } else { + expr = groupby_exprs.at(m); + is_existed = true; + } } else { /*do nothing.*/ } } } @@ -9289,17 +9384,36 @@ int ObTransformUtils::replace_with_groupby_exprs(ObSelectStmt *select_stmt, for (int64_t j = 0; OB_SUCC(ret) && !is_existed && j < rollup_list_exprs.count(); j++) { ObIArray &groupby_exprs = rollup_list_exprs.at(j).groupby_exprs_; for (int64_t k = 0; OB_SUCC(ret) && !is_existed && k < groupby_exprs.count(); k++) { + check_context.param_expr_.reset(); + check_context.equal_param_info_.reset(); if (OB_ISNULL(groupby_exprs.at(k))) { ret = OB_ERR_UNEXPECTED; LOG_WARN("got an unexpected null", K(ret)); } else if (groupby_exprs.at(k)->same_as(*expr, &check_context)) { - expr = groupby_exprs.at(k); - is_existed = true; + if (OB_FAIL(append(param_exprs_local, check_context.param_expr_))) { + LOG_WARN("fail to append param expr", K(ret)); + } else if (OB_FAIL(append(equal_params_local, check_context.equal_param_info_))) { + LOG_WARN("fail to append equal param info", K(ret)); + } else { + expr = groupby_exprs.at(k); + is_existed = true; + } } else { /*do nothing.*/ } } } } } + if (OB_SUCC(ret)) { + if (OB_FAIL(append_array_no_dup(eq_constraints, equal_params_local))) { + LOG_WARN("fail to append equal param info", K(ret)); + } else { + for (int64_t i = 0; OB_SUCC(ret) && i < param_exprs_local.count(); ++i) { + if (OB_FAIL(add_var_to_array_no_dup(param_expr_idxs, param_exprs_local.at(i).param_idx_))) { + LOG_WARN("fail to append equal param constraints", K(ret)); + } + } + } + } } return ret; } @@ -9307,6 +9421,7 @@ int ObTransformUtils::replace_with_groupby_exprs(ObSelectStmt *select_stmt, int ObTransformUtils::replace_add_exprs_with_groupby_exprs(ObRawExpr *&expr_l, ObRawExpr *expr_r, ObTransformerCtx *trans_ctx, + ObIArray & eq_constraints, bool &is_existed) { int ret = OB_SUCCESS; @@ -9339,8 +9454,14 @@ int ObTransformUtils::replace_add_exprs_with_groupby_exprs(ObRawExpr *&expr_l, } else if (check_objparam_negative(left_param) && !check_objparam_negative(right_param)) { // replace the expr with a T_OP_NEG expr who's child is groupby_exprs.at(k); ObOpRawExpr *neg = NULL; + ObPCParamEqualInfo eq_info; + eq_info.first_param_idx_ = idx_left; + eq_info.first_param_idx_ = idx_right; + eq_info.use_abs_cmp_ = true; if (OB_FAIL(expr_factory->create_raw_expr(T_OP_NEG, neg))) { LOG_WARN("failed to create neg expr", K(ret)); + } else if (OB_FAIL(eq_constraints.push_back(eq_info))) { + LOG_WARN("failed to push back equal param", K(ret)); } else if (OB_ISNULL(expr_l = neg)) { ret = OB_ERR_UNEXPECTED; LOG_WARN("neg expr is NULL", K(ret)); diff --git a/src/sql/rewrite/ob_transform_utils.h b/src/sql/rewrite/ob_transform_utils.h index 596fea1047..59b850f737 100644 --- a/src/sql/rewrite/ob_transform_utils.h +++ b/src/sql/rewrite/ob_transform_utils.h @@ -1338,12 +1338,20 @@ public: static int add_const_param_constraints(ObRawExpr *expr, ObTransformerCtx *ctx); - static int replace_stmt_expr_with_groupby_exprs(ObSelectStmt *select_stmt, + static int inner_replace_stmt_expr_with_groupby_exprs(ObSelectStmt *select_stmt, + const ParamStore *param_store, + ObIArray& pc_constrants, + ObIArray & eq_constraints, ObTransformerCtx *trans_ctx = NULL); + static int replace_stmt_expr_with_groupby_exprs(ObSelectStmt *select_stmt, + ObTransformerCtx *trans_ctx, + bool need_check_add_expr = false); + static int replace_add_exprs_with_groupby_exprs(ObRawExpr *&expr_l, ObRawExpr *expr_r, ObTransformerCtx *trans_ctx, + ObIArray & eq_constraints, bool &is_existed); static bool check_objparam_abs_equal(const ObObjParam &obj1, const ObObjParam &obj2); @@ -1357,8 +1365,11 @@ public: static int replace_with_groupby_exprs(ObSelectStmt *select_stmt, ObRawExpr *&expr, bool need_query_compare, + ObIArray& param_expr_idxs, + ObIArray & eq_constraints, ObTransformerCtx *tran_ctx = NULL, bool in_add_expr = false); + static int add_constraint_for_groupby_expr(ObTransformerCtx *trans_ctx, ObSelectStmt *select_stmt, ObRawExpr* groupby_expr, ObRawExpr* old_expr); static int add_param_not_null_constraint(ObTransformerCtx &ctx, ObIArray ¬_null_exprs); diff --git a/tools/deploy/mysql_test/test_suite/static_engine/r/mysql/static_engine_cmp_null.result b/tools/deploy/mysql_test/test_suite/static_engine/r/mysql/static_engine_cmp_null.result index 8e272a07b3..b5ba0f736b 100644 --- a/tools/deploy/mysql_test/test_suite/static_engine/r/mysql/static_engine_cmp_null.result +++ b/tools/deploy/mysql_test/test_suite/static_engine/r/mysql/static_engine_cmp_null.result @@ -950,7 +950,7 @@ Query Plan Outputs & filters: ------------------------------------- - 0 - output([cast(t.tinyint_t, DATETIME(-1, -1)) = t.datetime_t]), filter(nil), rowset=256, + 0 - output([cast(t.tinyint_t, DOUBLE(-1, -1)) = cast(t.datetime_t, DOUBLE(-1, -1))]), filter(nil), rowset=256, access([t.tinyint_t], [t.datetime_t]), partitions(p0), limit(1), offset(nil) @@ -990,7 +990,7 @@ Query Plan Outputs & filters: ------------------------------------- - 0 - output([cast(t.tinyint_t, DATE(-1, -1)) = t.date_t]), filter(nil), rowset=256, + 0 - output([cast(t.tinyint_t, DOUBLE(-1, -1)) = cast(t.date_t, DOUBLE(-1, -1))]), filter(nil), rowset=256, access([t.tinyint_t], [t.date_t]), partitions(p0), limit(1), offset(nil)