diff --git a/tests/pytest/functions/function_diff.py b/tests/pytest/functions/function_diff.py index 46ea3a86deee75d26f0b635ae0d3b2c5673fb6da..fba3b4c0d4bd16533ab9f67b42b3643449288cac 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 e03b892477eba46c007163049d91012af236e730..1e00309860d0c6fc1867f067e5124b8077c314c4 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()