From efd2eddf1687ec9f6720086d2e01418ebda2bb25 Mon Sep 17 00:00:00 2001 From: shenglian zhou Date: Mon, 13 Dec 2021 13:16:38 +0800 Subject: [PATCH] modify test case of string function concat --- tests/script/general/compute/str_concat.sim | 4 +++ tests/script/general/compute/str_concat2.sim | 23 ++++++------- .../script/general/compute/str_concat_ws2.sim | 32 +++++++++---------- 3 files changed, 30 insertions(+), 29 deletions(-) diff --git a/tests/script/general/compute/str_concat.sim b/tests/script/general/compute/str_concat.sim index a5d6b64ae7..b968e357af 100644 --- a/tests/script/general/compute/str_concat.sim +++ b/tests/script/general/compute/str_concat.sim @@ -2,6 +2,7 @@ sleep 100 sql connect sql use db +$emptyString = @@ print execute sql select concat(c8,*) from tb1; sql_error select concat(c8,*) from tb1; print execute sql select concat(c8,*) from tb1; @@ -493,6 +494,9 @@ endi if $data60 != @678@ then return -1 endi +if $data61 != $emptyString then + return -1 +endi if $data62 != @678@ then return -1 endi diff --git a/tests/script/general/compute/str_concat2.sim b/tests/script/general/compute/str_concat2.sim index da8474721b..4f4289719b 100644 --- a/tests/script/general/compute/str_concat2.sim +++ b/tests/script/general/compute/str_concat2.sim @@ -2,6 +2,7 @@ sleep 100 sql connect sql use db +$emptyString = @@ print execute sql select concat(stb1.c8,stb1.c14),pow(stba.c2,stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; sql select concat(stb1.c8,stb1.c14),pow(stba.c2,stba.c5) from stb1,stba where stb1.t1=stba.t1 and stb1.ts=stba.ts; if $data00 != @1231@ then @@ -132,51 +133,47 @@ if $data00 != @c8135@ then endi print execute sql select concat('c8',cast(avg(c2) as binary(10))) from tba1; sql select concat('c8',cast(avg(c2) as binary(10))) from tba1; -if $data00 != @c84.50@ then +if $data00 != @c84.500000@ then return -1 endi print execute sql select concat('c8',cast(percentile(c2, 10) as binary(10))) from tba1; sql select concat('c8',cast(percentile(c2, 10) as binary(10))) from tba1; -if $data00 != @c80.90@ then +if $data00 != @c80.900000@ then return -1 endi print execute sql select concat('c8',cast(apercentile(c2, 10) as binary(10))) from tba1; sql select concat('c8',cast(apercentile(c2, 10) as binary(10))) from tba1; -if $data00 != @c80.00@ then +if $data00 != @c80.000000@ then return -1 endi print execute sql select concat('c8',cast(stddev(c2) as binary(10))) from tba1; sql select concat('c8',cast(stddev(c2) as binary(10))) from tba1; -if $data00 != @c82.87@ then +if $data00 != @c82.872281@ then return -1 endi print execute sql select concat('c8',cast(spread(c2) as binary(10))) from tba1; sql select concat('c8',cast(spread(c2) as binary(10))) from tba1; -if $data00 != @c89.00@ then +if $data00 != @c89.000000@ then return -1 endi print execute sql select concat('c8',cast(twa(c2) as binary(10))) from tba1; sql select concat('c8',cast(twa(c2) as binary(10))) from tba1; -if $data00 != @c84.63@ then +if $data00 != @c84.637931@ then return -1 endi -print execute sql #select concat('c8',cast(interp(c2) as binary(10))) from tba1 every(1s) -sql_error #select concat('c8',cast(interp(c2) as binary(10))) from tba1 every(1s) -print execute sql #select concat('c8',cast(interp(c2) as binary(10))) from stba every(1s) group by tbname; -sql_error #select concat('c8',cast(interp(c2) as binary(10))) from stba every(1s) group by tbname; print execute sql select concat('c8',cast(elapsed(ts) as binary(10))) from tba1; sql select concat('c8',cast(elapsed(ts) as binary(10))) from tba1; -if $data00 != @c82900@ then +if $data00 != @c829000.0000@ then return -1 endi print execute sql select concat('c8',cast(rate(c2) as binary(10))) from tba1; sql select concat('c8',cast(rate(c2) as binary(10))) from tba1; -if $data00 != @c80.89@ then +if $data00 != @c80.896552@ then return -1 endi print execute sql select concat('c8',cast(irate(c2) as binary(10))) from tba1; sql select concat('c8',cast(irate(c2) as binary(10))) from tba1; -if $data00 != @c80.00@ then +if $data00 != @c80.000000@ then return -1 endi print execute sql select concat('c8',cast(first(c2) as binary(10))) from tba1; diff --git a/tests/script/general/compute/str_concat_ws2.sim b/tests/script/general/compute/str_concat_ws2.sim index 04ecd4e7eb..72cfa4fda8 100644 --- a/tests/script/general/compute/str_concat_ws2.sim +++ b/tests/script/general/compute/str_concat_ws2.sim @@ -113,82 +113,82 @@ if $data90 != @000sepa0@ then endi print execute sql select concat_ws('sepa','c8',cast(min(c2) as binary(10))) from tba1; sql select concat_ws('sepa','c8',cast(min(c2) as binary(10))) from tba1; -if $data00 != @c8sepa@ then +if $data00 != @c8sepa0@ then return -1 endi print execute sql select concat_ws('sepa','c8',cast(max(c2) as binary(10))) from tba1; sql select concat_ws('sepa','c8',cast(max(c2) as binary(10))) from tba1; -if $data00 != @c8sepa@ then +if $data00 != @c8sepa9@ then return -1 endi print execute sql select concat_ws('sepa','c8',cast(count(c2) as binary(10))) from tba1; sql select concat_ws('sepa','c8',cast(count(c2) as binary(10))) from tba1; -if $data00 != @c8sepa@ then +if $data00 != @c8sepa30@ then return -1 endi print execute sql select concat_ws('sepa','c8',cast(sum(c2) as binary(10))) from tba1; sql select concat_ws('sepa','c8',cast(sum(c2) as binary(10))) from tba1; -if $data00 != @c8sepa@ then +if $data00 != @c8sepa135@ then return -1 endi print execute sql select concat_ws('sepa','c8',cast(avg(c2) as binary(10))) from tba1; sql select concat_ws('sepa','c8',cast(avg(c2) as binary(10))) from tba1; -if $data00 != @c8sepa@ then +if $data00 != @c8sepa4.500000@ then return -1 endi print execute sql select concat_ws('sepa','c8',cast(percentile(c2, 10) as binary(10))) from tba1; sql select concat_ws('sepa','c8',cast(percentile(c2, 10) as binary(10))) from tba1; -if $data00 != @c8sepa@ then +if $data00 != @c8sepa0.900000@ then return -1 endi print execute sql select concat_ws('sepa','c8',cast(apercentile(c2, 10) as binary(10))) from tba1; sql select concat_ws('sepa','c8',cast(apercentile(c2, 10) as binary(10))) from tba1; -if $data00 != @c8sepa@ then +if $data00 != @c8sepa0.000000@ then return -1 endi print execute sql select concat_ws('sepa','c8',cast(stddev(c2) as binary(10))) from tba1; sql select concat_ws('sepa','c8',cast(stddev(c2) as binary(10))) from tba1; -if $data00 != @c8sepa@ then +if $data00 != @c8sepa2.872281@ then return -1 endi print execute sql select concat_ws('sepa','c8',cast(spread(c2) as binary(10))) from tba1; sql select concat_ws('sepa','c8',cast(spread(c2) as binary(10))) from tba1; -if $data00 != @c8sepa@ then +if $data00 != @c8sepa9.000000@ then return -1 endi print execute sql select concat_ws('sepa','c8',cast(twa(c2) as binary(10))) from tba1; sql select concat_ws('sepa','c8',cast(twa(c2) as binary(10))) from tba1; -if $data00 != @c8sepa@ then +if $data00 != @c8sepa4.637931@ then return -1 endi print execute sql select concat_ws('sepa','c8',cast(elapsed(ts) as binary(10))) from tba1; sql select concat_ws('sepa','c8',cast(elapsed(ts) as binary(10))) from tba1; -if $data00 != @c8sepa@ then +if $data00 != @c8sepa29000.0000@ then return -1 endi print execute sql select concat_ws('sepa','c8',cast(rate(c2) as binary(10))) from tba1; sql select concat_ws('sepa','c8',cast(rate(c2) as binary(10))) from tba1; -if $data00 != @c8sepa@ then +if $data00 != @c8sepa0.896552@ then return -1 endi print execute sql select concat_ws('sepa','c8',cast(irate(c2) as binary(10))) from tba1; sql select concat_ws('sepa','c8',cast(irate(c2) as binary(10))) from tba1; -if $data00 != @c8sepa@ then +if $data00 != @c8sepa0.000000@ then return -1 endi print execute sql select concat_ws('sepa','c8',cast(first(c2) as binary(10))) from tba1; sql select concat_ws('sepa','c8',cast(first(c2) as binary(10))) from tba1; -if $data00 != @c8sepa@ then +if $data00 != @c8sepa1@ then return -1 endi print execute sql select concat_ws('sepa','c8',cast(last(c2) as binary(10))) from tba1; sql select concat_ws('sepa','c8',cast(last(c2) as binary(10))) from tba1; -if $data00 != @c8sepa@ then +if $data00 != @c8sepa0@ then return -1 endi print execute sql select concat_ws('sepa','c8',cast(last_row(c2) as binary(10))) from tba1; sql select concat_ws('sepa','c8',cast(last_row(c2) as binary(10))) from tba1; -if $data00 != @c8sepa@ then +if $data00 != @c8sepa0@ then return -1 endi print execute sql select concat_ws('sepa','c8',cast(top(c2, 1) as binary(10))) from tba1; -- GitLab