change result type of not_expr from int to int32

This commit is contained in:
JinmaoLi
2024-05-20 06:46:28 +00:00
committed by ob-robot
parent a8864cf775
commit cefd6c6723
3 changed files with 19 additions and 12 deletions

View File

@ -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 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_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_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 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_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)) #define MOCK_CLUSTER_VERSION_4_2_3_0 (oceanbase::common::cal_version(4, 2, 3, 0))

View File

@ -42,8 +42,14 @@ int ObExprNot::calc_result_type1(ObExprResType &type,
if (NOT_ROW_DIMENSION == row_dimension_) { if (NOT_ROW_DIMENSION == row_dimension_) {
if (ObMaxType == type1.get_type()) { if (ObMaxType == type1.get_type()) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
} else {
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 { } else {
type.set_int(); type.set_int();
}
ObExprOperator::calc_result_flag1(type, type1); ObExprOperator::calc_result_flag1(type, type1);
type.set_scale(DEFAULT_SCALE_FOR_INTEGER); type.set_scale(DEFAULT_SCALE_FOR_INTEGER);
type.set_precision(DEFAULT_PRECISION_FOR_BOOL); type.set_precision(DEFAULT_PRECISION_FOR_BOOL);

View File

@ -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; 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 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 3 1 1 Y 32896 0 63
def !!w 8 1 1 Y 32896 0 63 def !!w 3 1 1 Y 32896 0 63
def !(!w) 8 1 1 Y 32896 0 63 def !(!w) 3 1 1 Y 32896 0 63
def ! !w 8 1 1 Y 32896 0 63 def ! !w 3 1 1 Y 32896 0 63
def not w 8 1 1 Y 32896 0 63 def not w 3 1 1 Y 32896 0 63
def not not w 8 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 true 3 1 1 N 32897 0 63
def w is not false 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 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 if(w,'true','false') 253 20 5 N 1 0 45
def !1+1 8 2 1 N 32897 0 63 def !1+1 8 2 1 N 32897 0 63
def !'a' 8 1 1 N 32897 0 63 def !'a' 3 1 1 N 32897 0 63
def !false 8 1 1 N 32897 0 63 def !false 3 1 1 N 32897 0 63
def !isnull('a') 8 1 1 N 32897 0 63 def !isnull('a') 3 1 1 N 32897 0 63
def !!isnull('a') 8 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') | | !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') |
+------+------+-------+------+-------+-----------+-----------+----------------+------------------+-----------------+----------------------+------+------+--------+--------------+---------------+ +------+------+-------+------+-------+-----------+-----------+----------------+------------------+-----------------+----------------------+------+------+--------+--------------+---------------+