diff --git a/src/share/ob_cluster_version.h b/src/share/ob_cluster_version.h index 9df14df0de..22d96967a5 100644 --- a/src/share/ob_cluster_version.h +++ b/src/share/ob_cluster_version.h @@ -174,6 +174,7 @@ cal_version(const uint64_t major, const uint64_t minor, const uint64_t major_pat #define CLUSTER_VERSION_4_2_1_2 (oceanbase::common::cal_version(4, 2, 1, 2)) #define MOCK_CLUSTER_VERSION_4_2_1_3 (oceanbase::common::cal_version(4, 2, 1, 3)) #define MOCK_CLUSTER_VERSION_4_2_1_4 (oceanbase::common::cal_version(4, 2, 1, 4)) +#define MOCK_CLUSTER_VERSION_4_2_1_7 (oceanbase::common::cal_version(4, 2, 1, 7)) #define CLUSTER_VERSION_4_2_2_0 (oceanbase::common::cal_version(4, 2, 2, 0)) #define MOCK_CLUSTER_VERSION_4_2_2_1 (oceanbase::common::cal_version(4, 2, 2, 1)) #define MOCK_CLUSTER_VERSION_4_2_3_0 (oceanbase::common::cal_version(4, 2, 3, 0)) diff --git a/src/sql/engine/expr/ob_expr_not.cpp b/src/sql/engine/expr/ob_expr_not.cpp index 4908274ae4..046a300fc0 100644 --- a/src/sql/engine/expr/ob_expr_not.cpp +++ b/src/sql/engine/expr/ob_expr_not.cpp @@ -43,7 +43,13 @@ int ObExprNot::calc_result_type1(ObExprResType &type, if (ObMaxType == type1.get_type()) { ret = OB_ERR_UNEXPECTED; } else { - type.set_int(); + if ((GET_MIN_CLUSTER_VERSION() >= MOCK_CLUSTER_VERSION_4_2_1_7 && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_2_2_0) || + (GET_MIN_CLUSTER_VERSION() >= MOCK_CLUSTER_VERSION_4_2_4_0 && GET_MIN_CLUSTER_VERSION() < CLUSTER_VERSION_4_3_0_0) || + GET_MIN_CLUSTER_VERSION() >= CLUSTER_VERSION_4_3_2_0) { + type.set_int32(); + } else { + type.set_int(); + } ObExprOperator::calc_result_flag1(type, type1); type.set_scale(DEFAULT_SCALE_FOR_INTEGER); type.set_precision(DEFAULT_PRECISION_FOR_BOOL); diff --git a/tools/deploy/mysql_test/test_suite/meta_info/r/mysql/meta_build_in_func_test.result b/tools/deploy/mysql_test/test_suite/meta_info/r/mysql/meta_build_in_func_test.result index 82408240a8..e491fb5c08 100644 --- a/tools/deploy/mysql_test/test_suite/meta_info/r/mysql/meta_build_in_func_test.result +++ b/tools/deploy/mysql_test/test_suite/meta_info/r/mysql/meta_build_in_func_test.result @@ -2835,22 +2835,22 @@ def test t1 t1 a a 8 20 1 Y 32768 0 63 +------+ select !w, !!w, !(!w), ! !w, not w, not not w, w is true, w is not false, (not w) is false, not(w is false), if(w,'true','false'), !1+1, !'a', !false, !isnull('a'), !!isnull('a') from (select 0 w union select 1) w; Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr -def !w 8 1 1 Y 32896 0 63 -def !!w 8 1 1 Y 32896 0 63 -def !(!w) 8 1 1 Y 32896 0 63 -def ! !w 8 1 1 Y 32896 0 63 -def not w 8 1 1 Y 32896 0 63 -def not not w 8 1 1 Y 32896 0 63 +def !w 3 1 1 Y 32896 0 63 +def !!w 3 1 1 Y 32896 0 63 +def !(!w) 3 1 1 Y 32896 0 63 +def ! !w 3 1 1 Y 32896 0 63 +def not w 3 1 1 Y 32896 0 63 +def not not w 3 1 1 Y 32896 0 63 def w is true 3 1 1 N 32897 0 63 def w is not false 3 1 1 N 32897 0 63 def (not w) is false 3 1 1 N 32897 0 63 -def not(w is false) 8 1 1 N 32897 0 63 +def not(w is false) 3 1 1 N 32897 0 63 def if(w,'true','false') 253 20 5 N 1 0 45 def !1+1 8 2 1 N 32897 0 63 -def !'a' 8 1 1 N 32897 0 63 -def !false 8 1 1 N 32897 0 63 -def !isnull('a') 8 1 1 N 32897 0 63 -def !!isnull('a') 8 1 1 N 32897 0 63 +def !'a' 3 1 1 N 32897 0 63 +def !false 3 1 1 N 32897 0 63 +def !isnull('a') 3 1 1 N 32897 0 63 +def !!isnull('a') 3 1 1 N 32897 0 63 +------+------+-------+------+-------+-----------+-----------+----------------+------------------+-----------------+----------------------+------+------+--------+--------------+---------------+ | !w | !!w | !(!w) | ! !w | not w | not not w | w is true | w is not false | (not w) is false | not(w is false) | if(w,'true','false') | !1+1 | !'a' | !false | !isnull('a') | !!isnull('a') | +------+------+-------+------+-------+-----------+-----------+----------------+------------------+-----------------+----------------------+------+------+--------+--------------+---------------+