diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 88f795e9299f4421a370e7b8b5b39e266448aa79..eeef9143178539dc45b5257778db34067500df2e 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -1892,7 +1892,7 @@ static int32_t handleAggTypeExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t } static int32_t handleSQLExprItem(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, int32_t exprIndex, tSqlExprItem* pItem) { - const char* msg1 = "invalid column name, illegal column type, or columns in arithmetic expression from two tables"; + const char* msg1 = "invalid column name, illegal column type, illegal function combination or columns in expression from two tables"; SColumnList columnList = {0}; int32_t sqlExprType = SQLEXPR_TYPE_UNASSIGNED; diff --git a/tests/script/fullGeneralSuite.sim b/tests/script/fullGeneralSuite.sim index 42386e5eaafbf42a84e6eb77576d4400d7c369c1..190a98e4b766c5c53e3aff5bea483ba32a113a04 100644 --- a/tests/script/fullGeneralSuite.sim +++ b/tests/script/fullGeneralSuite.sim @@ -39,6 +39,7 @@ run general/compute/sum.sim run general/compute/top.sim run general/compute/block_dist.sim run general/compute/scalar_pow.sim +run general/compute/scalar_triangle.sim run general/db/alter_option.sim run general/db/alter_tables_d2.sim run general/db/alter_tables_v1.sim @@ -140,6 +141,7 @@ run general/parser/groupby.sim run general/parser/top_groupby.sim run general/parser/tags_dynamically_specifiy.sim run general/parser/set_tag_vals.sim +run general/parser/scalar_expression.sim #unsupport run general/parser/repeatAlter.sim #unsupport run general/parser/slimit_alter_tags.sim run general/parser/precision_ns.sim diff --git a/tests/script/general/compute/testSuite.sim b/tests/script/general/compute/testSuite.sim index f8757d8e922a2774f9811dd4285431a631ca8167..977ca1237ea5e9c4239054130d7c5221b789304e 100644 --- a/tests/script/general/compute/testSuite.sim +++ b/tests/script/general/compute/testSuite.sim @@ -21,3 +21,4 @@ run general/compute/sum.sim run general/compute/top.sim run general/compute/block_dist.sim run general/compute/scalar_pow.sim +run general/compute/scalar_triangle.sim diff --git a/tests/script/general/parser/scalar_expression.sim b/tests/script/general/parser/scalar_expression.sim new file mode 100644 index 0000000000000000000000000000000000000000..b4fd4a68b313c821edf06e5e1e6d79548df39a83 --- /dev/null +++ b/tests/script/general/parser/scalar_expression.sim @@ -0,0 +1,101 @@ + +system sh/stop_dnodes.sh + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 1 +system sh/exec.sh -n dnode1 -s start +sleep 500 +sql connect + +$dbPrefix = db +$tbPrefix = ct +$mtPrefix = st +$tbNum = 2 +$rowNum = 50 + +print =============== step1 create stable/table +$i = 0 +$db = $dbPrefix . $i +$mt = $mtPrefix . $i + +sql drop database $db -x step1 +step1: +sql create database $db +sql use $db +sql create table $mt (ts timestamp, c1 int, c2 float, c3 bigint, c4 smallint, c5 tinyint, c6 double, c7 bool, c8 nchar(5), c9 binary(10)) TAGS (tgcol int) +$i = 0 +while $i < $tbNum + $tb = $tbPrefix . $i + sql create table $tb using $mt tags( $i ) + + $x = 0 + $y = 0.25 + + while $x < $rowNum + $cc = $x * 60000 + $ms = 1601481600000 + $cc + sql insert into $tb values ($ms , $x , $y , $x , $x , $x , $y , $x , $x , $x ) + $x = $x + 1 + $y = $y + 1 + endw + + $i = $i + 1 +endw + +print ================= step2 +$stb = $mtPrefix . 0 +$tb = $tbPrefix . 0 +print execute sql select floor(3.0)+ceil(4.0) from $tb +sql select floor(3.0)+ceil(4.0) from $tb +if $rows != 50 then + return -1 +endi +if $data00 != 7.000000000 then + return -1 +endi +if $data10 != 7.000000000 then + return -1 +endi +if $data20 != 7.000000000 then + return -1 +endi +if $data30 != 7.000000000 then + return -1 +endi +if $data40 != 7.000000000 then + return -1 +endi +if $data50 != 7.000000000 then + return -1 +endi +if $data60 != 7.000000000 then + return -1 +endi +if $data70 != 7.000000000 then + return -1 +endi +if $data80 != 7.000000000 then + return -1 +endi +if $data90 != 7.000000000 then + return -1 +endi + +print execute sql select sum(c1)+3.0+4.0 from $stb +sql select sum(c1)+3.0+4.0 from $stb +if $rows != 1 then + return -1 +endi +if $data00 != 2457.000000000 then + return -1 +endi + +print =============== clear +sql drop database $db +sql show databases +if $rows != 0 then + return -1 +endi + +system sh/exec.sh -n dnode1 -s stop -x SIGINT + diff --git a/tests/script/regressionSuite.sim b/tests/script/regressionSuite.sim index e1914c580d058f7d18785883a5cb62a631deaf4d..e794beac8b9591fb72f3d79ba766dae9dbcd5948 100644 --- a/tests/script/regressionSuite.sim +++ b/tests/script/regressionSuite.sim @@ -39,6 +39,7 @@ run general/compute/sum.sim run general/compute/top.sim run general/compute/block_dist.sim run general/compute/scalar_pow.sim +run general/compute/scalar_triangle.sim run general/db/alter_option.sim run general/db/alter_tables_d2.sim run general/db/alter_tables_v1.sim @@ -141,6 +142,7 @@ run general/parser/tags_dynamically_specifiy.sim run general/parser/set_tag_vals.sim run general/parser/repeatAlter.sim run general/parser/precision_ns.sim +run general/parser/scalar_expression.sim ##unsupport run general/parser/slimit_alter_tags.sim run general/stable/disk.sim run general/stable/dnode3.sim