From 8ff39302ce7fe9b9a9fbf61bf533fe38f0979b41 Mon Sep 17 00:00:00 2001 From: Ganlin Zhao Date: Thu, 20 Jan 2022 11:31:07 +0800 Subject: [PATCH] [TD-13109](query): Disable usage of match/nmatch/like/in/is(not) NULL operators in select --- tests/develop-test/2-query/func_compare.py | 85 ++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/tests/develop-test/2-query/func_compare.py b/tests/develop-test/2-query/func_compare.py index 80894b9e08..6a5b4c7e97 100644 --- a/tests/develop-test/2-query/func_compare.py +++ b/tests/develop-test/2-query/func_compare.py @@ -297,6 +297,91 @@ class TDTestCase: tdSql.error('select percentile(value, 50) or diff(value) = ceil(value) and apercentile(value, 50) from tb') tdSql.error('select floor(3.5) or round(3.5) and ceil(3.5) > true and round(3.5) or 3 from tb') + #operator: is NULL + tdSql.error('select count(*) is NULL from tb;') + tdSql.error('select avg(value) is NULL from tb;') + tdSql.error('select twa(value) is NULL from tb;') + tdSql.error('select sum(value) is NULL from tb;') + tdSql.error('select stddev(value) is NULL from tb;') + tdSql.error('select min(value) is NULL from tb;') + tdSql.error('select max(value) is NULL from tb;') + tdSql.error('select first(*) is NULL from tb;') + tdSql.error('select last(*) is NULL from tb;') + tdSql.error('select top(value, 3) is NULL or bottom(value,3) is NULL from tb;') + tdSql.error('select percentile(value, 50) is NULL or apercentile(value, 50) is NULL from tb') + tdSql.error('select diff(value) is NULL or ceil(value) is NULL from tb') + tdSql.error('select floor(3.5) is NULL or round(3.5) is NULL or ceil(3.5) is NULL from tb') + + #operator: is not NULL + tdSql.error('select count(*) is not NULL from tb;') + tdSql.error('select avg(value) is not NULL from tb;') + tdSql.error('select twa(value) is not NULL from tb;') + tdSql.error('select sum(value) is not NULL from tb;') + tdSql.error('select stddev(value) is not NULL from tb;') + tdSql.error('select min(value) is not NULL from tb;') + tdSql.error('select max(value) is not NULL from tb;') + tdSql.error('select first(*) is not NULL from tb;') + tdSql.error('select last(*) is not NULL from tb;') + tdSql.error('select top(value, 3) is not NULL or bottom(value,3) is not NULL from tb;') + tdSql.error('select percentile(value, 50) is not NULL or apercentile(value, 50) is not NULL from tb') + tdSql.error('select diff(value) is not NULL or ceil(value) is not NULL from tb') + tdSql.error('select floor(3.5) is not NULL or round(3.5) is not NULL or ceil(3.5) is not NULL from tb') + + #operator: like + tdSql.error('select count(*) like "abc" from tb;') + tdSql.error('select avg(value) like "abc" from tb;') + tdSql.error('select twa(value) like "abc" from tb;') + tdSql.error('select sum(value) like "abc" from tb;') + tdSql.error('select stddev(value) like "abc" from tb;') + tdSql.error('select min(value) like "abc" from tb;') + tdSql.error('select max(value) like "abc" from tb;') + tdSql.error('select first(*) like "abc" from tb;') + tdSql.error('select last(*) like "abc" from tb;') + tdSql.error('select top(value, 3) like "abc" or bottom(value,3) like "abc" from tb;') + tdSql.error('select percentile(value, 50) like "abc" or apercentile(value, 50) like "abc" from tb') + tdSql.error('select diff(value) like "abc" or ceil(value) like "abc" from tb') + tdSql.error('select floor(3.5) like "abc" or round(3.5) like "abc" or ceil(3.5) like "abc" from tb') + + #operator: match + tdSql.error('select count(*) match "abc" from tb;') + tdSql.error('select avg(value) match "abc" from tb;') + tdSql.error('select twa(value) match "abc" from tb;') + tdSql.error('select sum(value) match "abc" from tb;') + tdSql.error('select stddev(value) match "abc" from tb;') + tdSql.error('select min(value) match "abc" from tb;') + tdSql.error('select max(value) match "abc" from tb;') + tdSql.error('select first(*) match "abc" from tb;') + tdSql.error('select last(*) match "abc" from tb;') + tdSql.error('select top(value, 3) match "abc" or bottom(value,3) match "abc" from tb;') + tdSql.error('select percentile(value, 50) match "abc" or apercentile(value, 50) match "abc" from tb') + tdSql.error('select diff(value) match "abc" or ceil(value) match "abc" from tb') + tdSql.error('select floor(3.5) match "abc" or round(3.5) match "abc" or ceil(3.5) match "abc" from tb') + + #operator: nmatch + tdSql.error('select count(*) nmatch "abc" from tb;') + tdSql.error('select avg(value) nmatch "abc" from tb;') + tdSql.error('select twa(value) nmatch "abc" from tb;') + tdSql.error('select sum(value) nmatch "abc" from tb;') + tdSql.error('select stddev(value) nmatch "abc" from tb;') + tdSql.error('select min(value) nmatch "abc" from tb;') + tdSql.error('select max(value) nmatch "abc" from tb;') + tdSql.error('select first(*) nmatch "abc" from tb;') + tdSql.error('select last(*) nmatch "abc" from tb;') + tdSql.error('select top(value, 3) nmatch "abc" or bottom(value,3) nmatch "abc" from tb;') + tdSql.error('select percentile(value, 50) nmatch "abc" or apercentile(value, 50) nmatch "abc" from tb') + tdSql.error('select diff(value) nmatch "abc" or ceil(value) nmatch "abc" from tb') + tdSql.error('select floor(3.5) nmatch "abc" or round(3.5) nmatch "abc" or ceil(3.5) nmatch "abc" from tb') + + #operator: in + tdSql.error('select count(*) in 1 from tb;') + tdSql.error('select avg(value) in (1, 2, 3) from tb;') + tdSql.error('select twa(value) in 1.0 from tb;') + tdSql.error('select sum(value) in (1.0, 2.0, 3.0) from tb;') + tdSql.error('select min(value) in (true, false, true) from tb;') + tdSql.error('select tbname in (\'acd\', \'bce\') from tb;') + tdSql.error('select t in ("acd", "bce") from tb;') + tdSql.error('select top(value, 3) in (1,2,3) and ceil(value) in (1.0,2.0,3.0) or last(*) in ("abc","cde") from tb;') + tdSql.execute('drop database db') def stop(self): -- GitLab