diff --git a/tests/pytest/query/filterCombo.py b/tests/pytest/query/filterCombo.py index c25b6156b85484096723bb74ba4e8e48c2adad45..c9c7ade73eece9a33ae99177dc680463e22d2701 100644 --- a/tests/pytest/query/filterCombo.py +++ b/tests/pytest/query/filterCombo.py @@ -49,7 +49,8 @@ class TDTestCase: tdSql.error("select * from db.st where ts > '2020-05-13 10:00:00.002' OR tagtype < 2") # illegal condition - tdSql.error("select * from db.st where ts != '2020-05-13 10:00:00.002' OR tagtype < 2") + tdSql.error("select * from db.st where ts != '2020-05-13 10:00:00.002' OR tagtype < 2") + tdSql.error("select * from db.st where tagtype <> 1 OR tagtype < 2") def stop(self): tdSql.close() diff --git a/tests/pytest/query/queryError.py b/tests/pytest/query/queryError.py index d0515ef34dd14ba5b78c43c7023622f9978a319e..95924f48cc062b3756ab5e80fb72b45f707f8939 100644 --- a/tests/pytest/query/queryError.py +++ b/tests/pytest/query/queryError.py @@ -41,13 +41,12 @@ class TDTestCase: ('2020-05-13 10:00:00.002', 3, 'third') dev_002 VALUES('2020-05-13 10:00:00.003', 1, 'first'), ('2020-05-13 10:00:00.004', 2, 'second'), ('2020-05-13 10:00:00.005', 3, 'third')""") - """Error expected here, but no errors + # query first .. as .. tdSql.error("select first(*) as one from st") # query last .. as .. - tdSql.error("select last(*) as latest from st") - """ + tdSql.error("select last(*) as latest from st") # query last row .. as .. tdSql.error("select last_row as latest from st") diff --git a/tests/pytest/query/queryNormal.py b/tests/pytest/query/queryNormal.py index 3ca9c1d1357de6de3eb63347a2a104fd947a3e66..442661f72a4510e9d311ee38bbc16a204bf71670 100644 --- a/tests/pytest/query/queryNormal.py +++ b/tests/pytest/query/queryNormal.py @@ -31,14 +31,22 @@ class TDTestCase: tdSql.execute("create table stb1 (ts timestamp, c1 int, c2 float) tags(t1 int, t2 binary(10), t3 nchar(10))") tdSql.execute("insert into tb1 using stb1 tags(1,'tb1', '表1') values ('2020-04-18 15:00:00.000', 1, 0.1), ('2020-04-18 15:00:01.000', 2, 0.1)") tdSql.execute("insert into tb2 using stb1 tags(2,'tb2', '表2') values ('2020-04-18 15:00:02.000', 3, 2.1), ('2020-04-18 15:00:03.000', 4, 2.2)") - - # join 2 tables -- bug exists - # tdSql.query("select * from tb1 a, tb2 b where a.ts = b.ts") - # tdSql.checkRows(1) + + # inner join --- bug + tdSql.query("select * from tb1 a, tb2 b where a.ts = b.ts") + tdSql.checkRows(1) # join 3 tables -- bug exists - # tdSql.query("select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_p.id, stb_p.dscrption, stb_p.pressure,stb_v.velocity from stb_p, stb_t, stb_v where stb_p.ts=stb_t.ts and stb_p.ts=stb_v.ts and stb_p.id = stb_t.id") + tdSql.query("select stb_t.ts, stb_t.dscrption, stb_t.temperature, stb_p.id, stb_p.dscrption, stb_p.pressure,stb_v.velocity from stb_p, stb_t, stb_v where stb_p.ts=stb_t.ts and stb_p.ts=stb_v.ts and stb_p.id = stb_t.id") + # query show stable + tdSql.query("show stables") + tdSql.checkRows(1) + + # query show tables + tdSql.query("show table") + tdSql.checkRows(2) + # query count tdSql.query("select count(*) from stb1") tdSql.checkData(0, 0, 4) @@ -51,6 +59,10 @@ class TDTestCase: tdSql.query("select last(*) from stb1") tdSql.checkData(0, 1, 4) + # query last_row + tdSql.query("select last_row(*) from stb1") + tdSql.checkData(0, 1, 4) + # query as tdSql.query("select t2 as number from stb1") tdSql.checkRows(2) @@ -63,6 +75,10 @@ class TDTestCase: tdSql.query("select last(*) as end from stb1") tdSql.checkData(0, 1, 4) + # query last_row ... as + tdSql.query("select last_row(*) as end from stb1") + tdSql.checkData(0, 1, 4) + # query group .. by tdSql.query("select sum(c1), t2 from stb1 group by t2") tdSql.checkRows(2) @@ -75,6 +91,34 @@ class TDTestCase: tdSql.query("select * from stb1 limit 2 offset 3") tdSql.checkRows(1) + # query ... alias for table ---- bug + tdSql.query("select t.ts from tb1 t") + tdSql.checkRows(2) + + # query ... tbname + tdSql.query("select tbname from stb1") + tdSql.checkRows(2) + + # query ... tbname count ---- bug + tdSql.query("select count(tbname) from stb1") + tdSql.checkRows(2) + + # query ... select database ---- bug + tdSql.query("SELECT database()") + tdSql.checkRows(1) + + # query ... select client_version ---- bug + tdSql.query("SELECT client_version()") + tdSql.checkRows(1) + + # query ... select server_version ---- bug + tdSql.query("SELECT server_version()") + tdSql.checkRows(1) + + # query ... select server_status ---- bug + tdSql.query("SELECT server_status()") + tdSql.checkRows(1) + def stop(self): tdSql.close() tdLog.success("%s successfully executed" % __file__)