[TD-350]: add filter test cases for range

This commit is contained in:
Ping Xiao 2020-06-17 14:59:35 +08:00
parent 5a6ce2774b
commit 10774f580c
3 changed files with 58 additions and 2 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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):