未验证 提交 b728de00 编写于 作者: H huili 提交者: GitHub

Merge pull request #5850 from taosdata/xiaoping/add_test_case

[TD-3800]<test>: add test case for query last(*)
...@@ -16,7 +16,7 @@ import taos ...@@ -16,7 +16,7 @@ import taos
from util.log import * from util.log import *
from util.cases import * from util.cases import *
from util.sql import * from util.sql import *
from util.dnodes import *
class TDTestCase: class TDTestCase:
def init(self, conn, logSql): def init(self, conn, logSql):
...@@ -122,6 +122,32 @@ class TDTestCase: ...@@ -122,6 +122,32 @@ class TDTestCase:
tdSql.query("SELECT server_status()") tdSql.query("SELECT server_status()")
tdSql.checkRows(1) tdSql.checkRows(1)
# https://jira.taosdata.com:18080/browse/TD-3800
tdSql.execute("create table m1(ts timestamp, k int) tags(a int)")
tdSql.execute("create table tm0 using m1 tags(1)")
tdSql.execute("create table tm1 using m1 tags(2)")
tdSql.execute("insert into tm0 values('2020-3-1 1:1:1', 112)")
tdSql.execute("insert into tm1 values('2020-1-1 1:1:1', 1)('2020-3-1 0:1:1', 421)")
tdSql.query("select last(*) from m1 group by tbname")
tdSql.checkData(0, 0, "2020-03-01 01:01:01")
tdSql.checkData(0, 1, 112)
tdSql.checkData(0, 2, "tm0")
tdSql.checkData(1, 0, "2020-03-01 00:01:01")
tdSql.checkData(1, 1, 421)
tdSql.checkData(1, 2, "tm1")
tdDnodes.stop(1)
tdDnodes.start(1)
tdSql.query("select last(*) from m1 group by tbname")
tdSql.checkData(0, 0, "2020-03-01 01:01:01")
tdSql.checkData(0, 1, 112)
tdSql.checkData(0, 2, "tm0")
tdSql.checkData(1, 0, "2020-03-01 00:01:01")
tdSql.checkData(1, 1, 421)
tdSql.checkData(1, 2, "tm1")
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册