From d1ba0f58ef36f37ac9bf8b10957a693598da6b1c Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Mon, 19 Apr 2021 13:54:40 +0800 Subject: [PATCH] [TD-3800]: add test case for query last(*) --- tests/pytest/query/queryNormal.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tests/pytest/query/queryNormal.py b/tests/pytest/query/queryNormal.py index 4e3f9dd3bd..52e49a57c6 100644 --- a/tests/pytest/query/queryNormal.py +++ b/tests/pytest/query/queryNormal.py @@ -16,7 +16,7 @@ import taos from util.log import * from util.cases import * from util.sql import * - +from util.dnodes import * class TDTestCase: def init(self, conn, logSql): @@ -122,6 +122,32 @@ class TDTestCase: tdSql.query("SELECT server_status()") 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): tdSql.close() tdLog.success("%s successfully executed" % __file__) -- GitLab