From 5abe0e134e5b9f5af304c7b7591122e7d137291e Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Fri, 18 Mar 2022 13:02:54 +0800 Subject: [PATCH] [TD-14121]: script/general/compute/cast.sim failed on ARM64 Linux --- src/common/src/texpr.c | 6 ++++++ tests/script/general/compute/cast_query1.sim | 17 +++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/common/src/texpr.c b/src/common/src/texpr.c index 2774d9e2fa..4c0bb1ae52 100644 --- a/src/common/src/texpr.c +++ b/src/common/src/texpr.c @@ -1725,6 +1725,9 @@ void castConvert(int16_t inputType, int16_t inputBytes, char *input, int16_t Out tfree(newColData); } else { GET_TYPED_DATA(*(int64_t *)output, int64_t, inputType, input); + if (*(int64_t *)output == TSDB_DATA_BIGINT_NULL) { + SET_TYPED_DATA(output, OutputType, INT64_MAX); + } } break; case TSDB_DATA_TYPE_UBIGINT: @@ -1755,6 +1758,9 @@ void castConvert(int16_t inputType, int16_t inputBytes, char *input, int16_t Out } else { GET_TYPED_DATA(*(int64_t *)output, int64_t, inputType, input); } + if (*(int64_t *)output == TSDB_DATA_BIGINT_NULL) { + SET_TYPED_DATA(output, OutputType, INT64_MAX); + } break; case TSDB_DATA_TYPE_BINARY: if (inputType == TSDB_DATA_TYPE_BOOL) { diff --git a/tests/script/general/compute/cast_query1.sim b/tests/script/general/compute/cast_query1.sim index de0722bcd8..8e560025b8 100644 --- a/tests/script/general/compute/cast_query1.sim +++ b/tests/script/general/compute/cast_query1.sim @@ -1158,10 +1158,10 @@ endi if $data40 != 4 then return -1 endi -if $data50 != NULL then +if $data50 != 9223372036854775807 then return -1 endi -if $data60 != NULL then +if $data60 != 9223372036854775807 then return -1 endi sql select cast(c6 as binary(60)) from tb1; @@ -1233,10 +1233,11 @@ endi if $data40 != @70-01-01 08:00:00.004@ then return -1 endi -if $data50 != NULL then +print $data50 +if $data50 != @94-08-17 15:12:55.807@ then return -1 endi -if $data60 != NULL then +if $data60 != @94-08-17 15:12:55.807@ then return -1 endi sql select cast(c6 as nchar(50)) from tb1; @@ -1331,10 +1332,10 @@ endi if $data40 != 4 then return -1 endi -if $data50 != NULL then +if $data50 != 9223372036854775807 then return -1 endi -if $data60 != NULL then +if $data60 != 9223372036854775807 then return -1 endi sql select cast(c7 as binary(400)) from tb1; @@ -1406,10 +1407,10 @@ endi if $data40 != @70-01-01 08:00:00.004@ then return -1 endi -if $data50 != NULL then +if $data50 != @94-08-17 15:12:55.807@ then return -1 endi -if $data60 != NULL then +if $data60 != @94-08-17 15:12:55.807@ then return -1 endi sql select cast(c7 as nchar(500)) from tb1; -- GitLab