From 5a0d44a82f5efe6479139ce5caba8c0fe7b94504 Mon Sep 17 00:00:00 2001 From: Ping Xiao Date: Wed, 9 Jun 2021 18:31:08 +0800 Subject: [PATCH] [TD-4602]: add test case: diff function for super table --- tests/pytest/functions/function_diff.py | 24 ++++++++++++++++++- .../pytest/functions/function_diff_restart.py | 6 +++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/tests/pytest/functions/function_diff.py b/tests/pytest/functions/function_diff.py index 46ea3a86de..fba3b4c0d4 100644 --- a/tests/pytest/functions/function_diff.py +++ b/tests/pytest/functions/function_diff.py @@ -26,7 +26,20 @@ class TDTestCase: self.rowNum = 10 self.ts = 1537146000000 - + self.perfix = 'dev' + self.tables = 10 + + def insertData(self): + print("==============step1") + tdSql.execute( + "create table if not exists st (ts timestamp, col int) tags(dev nchar(50))") + + for i in range(self.tables): + tdSql.execute("create table %s%d using st tags(%d)" % (self.perfix, i, i)) + rows = 15 + i + for j in range(rows): + tdSql.execute("insert into %s%d values(%d, %d)" %(self.perfix, i, self.ts + i * 20 * 10000 + j * 10000, j)) + def run(self): tdSql.prepare() @@ -99,6 +112,15 @@ class TDTestCase: tdSql.query("select diff(col6) from test1") tdSql.checkRows(10) + + self.insertData() + + tdSql.query("select diff(col) from st group by tbname") + tdSql.checkRows(185) + + tdSql.error("select diff(col) from st group by dev") + + tdSql.error("select diff(col) from st group by col") def stop(self): tdSql.close() diff --git a/tests/pytest/functions/function_diff_restart.py b/tests/pytest/functions/function_diff_restart.py index e03b892477..1e00309860 100644 --- a/tests/pytest/functions/function_diff_restart.py +++ b/tests/pytest/functions/function_diff_restart.py @@ -97,6 +97,12 @@ class TDTestCase: tdSql.query("select diff(col6) from test1") tdSql.checkRows(10) + + tdSql.query("select diff(col) from st group by tbname") + tdSql.checkRows(185) + + tdSql.error("select diff(col) from st group by dev") + tdSql.error("select diff(col) from st group by col") def stop(self): tdSql.close() -- GitLab