From 1e5b4c75f9ee0b67667da139934bb901ec0a31cd Mon Sep 17 00:00:00 2001 From: skylhd Date: Fri, 19 May 2023 09:17:25 +0000 Subject: [PATCH] [BUGFIX] fix merge join cmp exchange left and right --- src/sql/code_generator/ob_static_engine_cg.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/sql/code_generator/ob_static_engine_cg.cpp b/src/sql/code_generator/ob_static_engine_cg.cpp index 125a45122f..432a55f5f3 100644 --- a/src/sql/code_generator/ob_static_engine_cg.cpp +++ b/src/sql/code_generator/ob_static_engine_cg.cpp @@ -4352,11 +4352,19 @@ int ObStaticEngineCG::generate_join_spec(ObLogJoin &op, ObJoinSpec &spec) CK(l.cs_type_ == r.cs_type_); if (OB_SUCC(ret)) { const ObScale scale = ObDatumFuncs::max_scale(l.scale_, r.scale_); - equal_cond_info.ns_cmp_func_ = ObDatumFuncs::get_nullsafe_cmp_func(l.type_, - r.type_, default_null_pos(), l.cs_type_, scale, is_oracle_mode(), - has_lob_header); - CK(OB_NOT_NULL(equal_cond_info.ns_cmp_func_)); OZ(calc_equal_cond_opposite(op, *raw_expr, equal_cond_info.is_opposite_)); + if (OB_SUCC(ret)) { + if (equal_cond_info.is_opposite_) { + equal_cond_info.ns_cmp_func_ = ObDatumFuncs::get_nullsafe_cmp_func(r.type_, + l.type_, default_null_pos(), r.cs_type_, scale, is_oracle_mode(), + has_lob_header); + } else { + equal_cond_info.ns_cmp_func_ = ObDatumFuncs::get_nullsafe_cmp_func(l.type_, + r.type_, default_null_pos(), l.cs_type_, scale, is_oracle_mode(), + has_lob_header); + } + } + CK(OB_NOT_NULL(equal_cond_info.ns_cmp_func_)); OZ(mj_spec.equal_cond_infos_.push_back(equal_cond_info)); // when is_opposite_ is true: left child fetcher accept right // arg(args_[1]) and vice versa