From 8337b4474bbc2bdf5f3d9dbaca997201d06d34a9 Mon Sep 17 00:00:00 2001 From: "wenzhouwww@live.cn" Date: Fri, 15 Jul 2022 17:43:45 +0800 Subject: [PATCH] update case --- tests/system-test/2-query/last_row.py | 152 +++++++++++++++----------- 1 file changed, 87 insertions(+), 65 deletions(-) diff --git a/tests/system-test/2-query/last_row.py b/tests/system-test/2-query/last_row.py index 449f5c7806..4d6fe08c62 100644 --- a/tests/system-test/2-query/last_row.py +++ b/tests/system-test/2-query/last_row.py @@ -488,7 +488,14 @@ class TDTestCase: # bug fix for compute tdSql.query("select last_row(c1) -0 ,last(c1)-0 ,last(c1)+last_row(c1) from ct4 ") - tdSql.query(" select c1, abs(c1) -0 ,last_row(c1-0.1)-0.1 from ct4") + tdSql.checkData(0,0,None) + tdSql.checkData(0,1,None) + tdSql.checkData(0,2,None) + + tdSql.query(" select c1, abs(c1) -0 ,last_row(c1-0.1)-0.1 from ct1") + tdSql.checkData(0,0,9) + tdSql.checkData(0,1,9.000000000) + tdSql.checkData(0,2,8.800000000) def abs_func_filter(self): tdSql.execute("use db") @@ -616,7 +623,7 @@ class TDTestCase: tdSql.error("select last_row(c1) ,c1 from (select count(c1) c1 from stb1 where ts >now -1h and ts ="2022-07-06 16:00:00.000 " and ts < "2022-07-06 17:00:00.000 " interval(50s) sliding(30s) fill(NULL)') - # tdSql.checkRows(40) - # tdSql.checkData(0,0,None) - tdSql.query('select max(c1) from stb1 where ts>="2022-07-06 16:00:00.000 " and ts < "2022-07-06 17:00:00.000 " interval(50s) sliding(30s)') - tdSql.checkRows(5) + tdSql.query("select last_row(c1) from stb1 interval(50s) sliding(30s)") + tdSql.checkRows(27) + tdSql.query("select last_row(c1) from ct1 interval(50s) sliding(30s)") + tdSql.checkRows(5) + last_row_result = tdSql.queryResult + tdSql.query("select last(c1) from ct1 interval(50s) sliding(30s)") + for ind , row in enumerate(last_row_result): + tdSql.checkData(ind , 0 , row[0]) + + # bug need fix + tdSql.query('select max(c1) from t1 where ts>="2021-01-01 01:01:06.000" and ts < "2021-07-21 01:01:01.000" interval(50d) sliding(30d) fill(NULL)') + tdSql.checkRows(8) + tdSql.checkData(7,0,None) + + tdSql.query('select last_row(c1) from t1 where ts>="2021-01-01 01:01:06.000" and ts < "2021-07-21 01:01:01.000" interval(50d) sliding(30d) fill(value ,2 )') + tdSql.checkRows(8) + tdSql.checkData(7,0,2) + + tdSql.query('select last_row(c1) from stb1 where ts>="2022-07-06 16:00:00.000 " and ts < "2022-07-06 17:00:00.000 " interval(50s) sliding(30s)') + tdSql.query('select last_row(c1) from (select ts , c1 from t1 where ts>="2021-01-01 01:01:06.000" and ts < "2021-07-21 01:01:01.000" ) interval(10s) sliding(5s)') + + # join + tdSql.query("use test") + tdSql.query("select last(sub_tb_1.c1), last(sub_tb_2.c2) from sub_tb_1, sub_tb_2 where sub_tb_1.ts=sub_tb_2.ts") + tdSql.checkCols(2) + last_row_result = tdSql.queryResult + tdSql.query("select last_row(sub_tb_1.c1), last_row(sub_tb_2.c2) from sub_tb_1, sub_tb_2 where sub_tb_1.ts=sub_tb_2.ts") + + for ind , row in enumerate(last_row_result): + tdSql.checkData(ind , 0 , row[0]) + + tdSql.query("select last(*), last(*) from sub_tb_1, sub_tb_2 where sub_tb_1.ts=sub_tb_2.ts") + + last_row_result = tdSql.queryResult + tdSql.query("select last_row(*), last_row(*) from sub_tb_1, sub_tb_2 where sub_tb_1.ts=sub_tb_2.ts") + for ind , row in enumerate(last_row_result): + tdSql.checkData(ind , 0 , row[0]) + def support_super_table_test(self):