From 10774f580cc7edea2e8851ce19528c3786cdb621 Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Wed, 17 Jun 2020 14:59:35 +0800 Subject: [PATCH] [TD-350]: add filter test cases for range --- tests/pytest/query/filterAllIntTypes.py | 30 ++++++++++++++++++++++ tests/pytest/query/filterFloatAndDouble.py | 26 +++++++++++++++++++ tests/pytest/query/filterOtherTypes.py | 4 +-- 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/tests/pytest/query/filterAllIntTypes.py b/tests/pytest/query/filterAllIntTypes.py index cf65d2b102..a2bab63c88 100644 --- a/tests/pytest/query/filterAllIntTypes.py +++ b/tests/pytest/query/filterAllIntTypes.py @@ -88,6 +88,19 @@ class TDTestCase: tdSql.query("select * from st%s where num != 50" % curType) tdSql.checkRows(101) + # range for int type on column + tdSql.query("select * from st%s where num > 50 and num < 100" % curType) + tdSql.checkRows(49) + + tdSql.query("select * from st%s where num >= 50 and num < 100" % curType) + tdSql.checkRows(50) + + tdSql.query("select * from st%s where num > 50 and num <= 100" % curType) + tdSql.checkRows(50) + + tdSql.query("select * from st%s where num >= 50 and num <= 100" % curType) + tdSql.checkRows(51) + # > for int type on tag tdSql.query("select * from st%s where id > 5" % curType) tdSql.checkRows(52) @@ -116,6 +129,23 @@ class TDTestCase: tdSql.query("select * from st%s where id != 5" % curType) tdSql.checkRows(92) + # != for int type on tag + tdSql.query("select * from st%s where id != 5" % curType) + tdSql.checkRows(92) + + # range for int type on tag + tdSql.query("select * from st%s where id > 5 and id < 7" % curType) + tdSql.checkRows(10) + + tdSql.query("select * from st%s where id >= 5 and id < 7" % curType) + tdSql.checkRows(20) + + tdSql.query("select * from st%s where id > 5 and id <= 7" % curType) + tdSql.checkRows(20) + + tdSql.query("select * from st%s where id >= 5 and id <= 7" % curType) + tdSql.checkRows(30) + print( "======= Verify filter for %s type finished =========" % curType) diff --git a/tests/pytest/query/filterFloatAndDouble.py b/tests/pytest/query/filterFloatAndDouble.py index bd349a2a25..8d0e5baeca 100644 --- a/tests/pytest/query/filterFloatAndDouble.py +++ b/tests/pytest/query/filterFloatAndDouble.py @@ -67,6 +67,19 @@ class TDTestCase: tdSql.query("select * from st where num < 5.5") tdSql.checkRows(4) + # range for float type on column + tdSql.query("select * from st where num > 5.5 and num < 11.0") + tdSql.checkRows(4) + + tdSql.query("select * from st where num >= 5.5 and num < 11.0") + tdSql.checkRows(5) + + tdSql.query("select * from st where num > 5.5 and num <= 11.0") + tdSql.checkRows(5) + + tdSql.query("select * from st where num >= 5.5 and num <= 11.0") + tdSql.checkRows(6) + # > for float type on tag tdSql.query("select * from st where tagcol1 > 1.1") tdSql.checkRows(0) @@ -123,6 +136,19 @@ class TDTestCase: tdSql.query("select * from st where speed < 11.5") tdSql.checkRows(4) + # range for double type on column + tdSql.query("select * from st where speed > 11.5 and speed < 20.7") + tdSql.checkRows(3) + + tdSql.query("select * from st where speed >= 11.5 and speed < 20.7") + tdSql.checkRows(4) + + tdSql.query("select * from st where speed > 11.5 and speed <= 20.7") + tdSql.checkRows(4) + + tdSql.query("select * from st where speed >= 11.5 and speed <= 20.7") + tdSql.checkRows(5) + # > for double type on tag tdSql.query("select * from st where tagcol2 > 2.3") tdSql.checkRows(0) diff --git a/tests/pytest/query/filterOtherTypes.py b/tests/pytest/query/filterOtherTypes.py index bc7df18c8d..1db5497604 100644 --- a/tests/pytest/query/filterOtherTypes.py +++ b/tests/pytest/query/filterOtherTypes.py @@ -30,9 +30,9 @@ class TDTestCase: print("======= Verify filter for bool, nchar and binary type =========") tdLog.debug( - "create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))") + "create table st(ts timestamp, tbcol1 bool, tbcol2 binary(10), tbcol3 nchar(20)) tags(tagcol1 bool, tagcol2 binary(10), tagcol3 nchar(10))") tdSql.execute( - "create table st(ts timestamp, tbcol1 bool, tbcol2 nchar(10), tbcol3 binary(20)) tags(tagcol1 bool, tagcol2 nchar(10), tagcol3 binary(10))") + "create table st(ts timestamp, tbcol1 bool, tbcol2 binary(10), tbcol3 nchar(20)) tags(tagcol1 bool, tagcol2 binary(10), tagcol3 nchar(10))") tdSql.execute("create table st1 using st tags(true, 'table1', '水表')") for i in range(1, 6): -- GitLab