提交 a2c1c8ea 编写于 作者: G Ganlin Zhao

add test cases

上级 5738ba08
......@@ -356,8 +356,227 @@ class TDTestCase:
tdSql.query(f"select interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:16', '2020-02-01 00:00:19') every(1s) fill(linear)")
tdSql.checkRows(0)
tdLog.printNoPrefix("==========step8:test _irowts with interp")
# fill null
tdSql.query(f"select _irowts,interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:08', '2020-02-01 00:00:12') every(500a) fill(null)")
tdSql.checkRows(9)
tdSql.checkCols(2)
tdSql.checkData(0, 0, '2020-02-01 00:00:08.000')
tdSql.checkData(1, 0, '2020-02-01 00:00:08.500')
tdSql.checkData(2, 0, '2020-02-01 00:00:09.000')
tdSql.checkData(3, 0, '2020-02-01 00:00:09.500')
tdSql.checkData(4, 0, '2020-02-01 00:00:10.000')
tdSql.checkData(5, 0, '2020-02-01 00:00:10.500')
tdSql.checkData(6, 0, '2020-02-01 00:00:11.000')
tdSql.checkData(7, 0, '2020-02-01 00:00:11.500')
tdSql.checkData(8, 0, '2020-02-01 00:00:12.000')
tdSql.query(f"select _irowts,interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(null)")
tdSql.checkRows(13)
tdSql.checkCols(2)
tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
tdSql.checkData(1, 0, '2020-02-01 00:00:05.000')
tdSql.checkData(2, 0, '2020-02-01 00:00:06.000')
tdSql.checkData(3, 0, '2020-02-01 00:00:07.000')
tdSql.checkData(4, 0, '2020-02-01 00:00:08.000')
tdSql.checkData(5, 0, '2020-02-01 00:00:09.000')
tdSql.checkData(6, 0, '2020-02-01 00:00:10.000')
tdSql.checkData(7, 0, '2020-02-01 00:00:11.000')
tdSql.checkData(8, 0, '2020-02-01 00:00:12.000')
tdSql.checkData(9, 0, '2020-02-01 00:00:13.000')
tdSql.checkData(10, 0, '2020-02-01 00:00:14.000')
tdSql.checkData(11, 0, '2020-02-01 00:00:15.000')
tdSql.checkData(12, 0, '2020-02-01 00:00:16.000')
tdSql.query(f"select _irowts,interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:05', '2020-02-01 00:00:15') every(2s) fill(null)")
tdSql.checkRows(6)
tdSql.checkCols(2)
tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
tdSql.checkData(1, 0, '2020-02-01 00:00:07.000')
tdSql.checkData(2, 0, '2020-02-01 00:00:09.000')
tdSql.checkData(3, 0, '2020-02-01 00:00:11.000')
tdSql.checkData(4, 0, '2020-02-01 00:00:13.000')
tdSql.checkData(5, 0, '2020-02-01 00:00:15.000')
# fill value
tdSql.query(f"select _irowts,interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:08', '2020-02-01 00:00:12') every(500a) fill(value, 1)")
tdSql.checkRows(9)
tdSql.checkCols(2)
tdSql.checkData(0, 0, '2020-02-01 00:00:08.000')
tdSql.checkData(1, 0, '2020-02-01 00:00:08.500')
tdSql.checkData(2, 0, '2020-02-01 00:00:09.000')
tdSql.checkData(3, 0, '2020-02-01 00:00:09.500')
tdSql.checkData(4, 0, '2020-02-01 00:00:10.000')
tdSql.checkData(5, 0, '2020-02-01 00:00:10.500')
tdSql.checkData(6, 0, '2020-02-01 00:00:11.000')
tdSql.checkData(7, 0, '2020-02-01 00:00:11.500')
tdSql.checkData(8, 0, '2020-02-01 00:00:12.000')
tdSql.query(f"select _irowts,interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(value, 1)")
tdSql.checkRows(13)
tdSql.checkCols(2)
tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
tdSql.checkData(1, 0, '2020-02-01 00:00:05.000')
tdSql.checkData(2, 0, '2020-02-01 00:00:06.000')
tdSql.checkData(3, 0, '2020-02-01 00:00:07.000')
tdSql.checkData(4, 0, '2020-02-01 00:00:08.000')
tdSql.checkData(5, 0, '2020-02-01 00:00:09.000')
tdSql.checkData(6, 0, '2020-02-01 00:00:10.000')
tdSql.checkData(7, 0, '2020-02-01 00:00:11.000')
tdSql.checkData(8, 0, '2020-02-01 00:00:12.000')
tdSql.checkData(9, 0, '2020-02-01 00:00:13.000')
tdSql.checkData(10, 0, '2020-02-01 00:00:14.000')
tdSql.checkData(11, 0, '2020-02-01 00:00:15.000')
tdSql.checkData(12, 0, '2020-02-01 00:00:16.000')
tdSql.query(f"select _irowts,interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:05', '2020-02-01 00:00:15') every(2s) fill(value, 1)")
tdSql.checkRows(6)
tdSql.checkCols(2)
tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
tdSql.checkData(1, 0, '2020-02-01 00:00:07.000')
tdSql.checkData(2, 0, '2020-02-01 00:00:09.000')
tdSql.checkData(3, 0, '2020-02-01 00:00:11.000')
tdSql.checkData(4, 0, '2020-02-01 00:00:13.000')
tdSql.checkData(5, 0, '2020-02-01 00:00:15.000')
# fill prev
tdSql.query(f"select _irowts,interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:08', '2020-02-01 00:00:12') every(500a) fill(prev)")
tdSql.checkRows(9)
tdSql.checkCols(2)
tdSql.checkData(0, 0, '2020-02-01 00:00:08.000')
tdSql.checkData(1, 0, '2020-02-01 00:00:08.500')
tdSql.checkData(2, 0, '2020-02-01 00:00:09.000')
tdSql.checkData(3, 0, '2020-02-01 00:00:09.500')
tdSql.checkData(4, 0, '2020-02-01 00:00:10.000')
tdSql.checkData(5, 0, '2020-02-01 00:00:10.500')
tdSql.checkData(6, 0, '2020-02-01 00:00:11.000')
tdSql.checkData(7, 0, '2020-02-01 00:00:11.500')
tdSql.checkData(8, 0, '2020-02-01 00:00:12.000')
tdSql.query(f"select _irowts,interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(prev)")
tdSql.checkRows(12)
tdSql.checkCols(2)
tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
tdSql.checkData(1, 0, '2020-02-01 00:00:06.000')
tdSql.checkData(2, 0, '2020-02-01 00:00:07.000')
tdSql.checkData(3, 0, '2020-02-01 00:00:08.000')
tdSql.checkData(4, 0, '2020-02-01 00:00:09.000')
tdSql.checkData(5, 0, '2020-02-01 00:00:10.000')
tdSql.checkData(6, 0, '2020-02-01 00:00:11.000')
tdSql.checkData(7, 0, '2020-02-01 00:00:12.000')
tdSql.checkData(8, 0, '2020-02-01 00:00:13.000')
tdSql.checkData(9, 0, '2020-02-01 00:00:14.000')
tdSql.checkData(10, 0, '2020-02-01 00:00:15.000')
tdSql.checkData(11, 0, '2020-02-01 00:00:16.000')
tdSql.query(f"select _irowts,interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:05', '2020-02-01 00:00:15') every(2s) fill(prev)")
tdSql.checkRows(6)
tdSql.checkCols(2)
tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
tdSql.checkData(1, 0, '2020-02-01 00:00:07.000')
tdSql.checkData(2, 0, '2020-02-01 00:00:09.000')
tdSql.checkData(3, 0, '2020-02-01 00:00:11.000')
tdSql.checkData(4, 0, '2020-02-01 00:00:13.000')
tdSql.checkData(5, 0, '2020-02-01 00:00:15.000')
# fill next
tdSql.query(f"select _irowts,interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:08', '2020-02-01 00:00:12') every(500a) fill(next)")
tdSql.checkRows(9)
tdSql.checkCols(2)
tdSql.checkData(0, 0, '2020-02-01 00:00:08.000')
tdSql.checkData(1, 0, '2020-02-01 00:00:08.500')
tdSql.checkData(2, 0, '2020-02-01 00:00:09.000')
tdSql.checkData(3, 0, '2020-02-01 00:00:09.500')
tdSql.checkData(4, 0, '2020-02-01 00:00:10.000')
tdSql.checkData(5, 0, '2020-02-01 00:00:10.500')
tdSql.checkData(6, 0, '2020-02-01 00:00:11.000')
tdSql.checkData(7, 0, '2020-02-01 00:00:11.500')
tdSql.checkData(8, 0, '2020-02-01 00:00:12.000')
tdSql.query(f"select _irowts,interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(next)")
tdSql.checkRows(12)
tdSql.checkCols(2)
tdSql.checkData(0, 0, '2020-02-01 00:00:04.000')
tdSql.checkData(1, 0, '2020-02-01 00:00:05.000')
tdSql.checkData(2, 0, '2020-02-01 00:00:06.000')
tdSql.checkData(3, 0, '2020-02-01 00:00:07.000')
tdSql.checkData(4, 0, '2020-02-01 00:00:08.000')
tdSql.checkData(5, 0, '2020-02-01 00:00:09.000')
tdSql.checkData(6, 0, '2020-02-01 00:00:10.000')
tdSql.checkData(7, 0, '2020-02-01 00:00:11.000')
tdSql.checkData(8, 0, '2020-02-01 00:00:12.000')
tdSql.checkData(9, 0, '2020-02-01 00:00:13.000')
tdSql.checkData(10, 0, '2020-02-01 00:00:14.000')
tdSql.checkData(11, 0, '2020-02-01 00:00:15.000')
tdSql.query(f"select _irowts,interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:05', '2020-02-01 00:00:15') every(2s) fill(next)")
tdSql.checkRows(6)
tdSql.checkCols(2)
tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
tdSql.checkData(1, 0, '2020-02-01 00:00:07.000')
tdSql.checkData(2, 0, '2020-02-01 00:00:09.000')
tdSql.checkData(3, 0, '2020-02-01 00:00:11.000')
tdSql.checkData(4, 0, '2020-02-01 00:00:13.000')
tdSql.checkData(5, 0, '2020-02-01 00:00:15.000')
# fill linear
tdSql.query(f"select _irowts,interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:08', '2020-02-01 00:00:12') every(500a) fill(linear)")
tdSql.checkRows(9)
tdSql.checkCols(2)
tdSql.checkData(0, 0, '2020-02-01 00:00:08.000')
tdSql.checkData(1, 0, '2020-02-01 00:00:08.500')
tdSql.checkData(2, 0, '2020-02-01 00:00:09.000')
tdSql.checkData(3, 0, '2020-02-01 00:00:09.500')
tdSql.checkData(4, 0, '2020-02-01 00:00:10.000')
tdSql.checkData(5, 0, '2020-02-01 00:00:10.500')
tdSql.checkData(6, 0, '2020-02-01 00:00:11.000')
tdSql.checkData(7, 0, '2020-02-01 00:00:11.500')
tdSql.checkData(8, 0, '2020-02-01 00:00:12.000')
tdSql.query(f"select _irowts,interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(linear)")
tdSql.checkRows(11)
tdSql.checkCols(2)
tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
tdSql.checkData(1, 0, '2020-02-01 00:00:06.000')
tdSql.checkData(2, 0, '2020-02-01 00:00:07.000')
tdSql.checkData(3, 0, '2020-02-01 00:00:08.000')
tdSql.checkData(4, 0, '2020-02-01 00:00:09.000')
tdSql.checkData(5, 0, '2020-02-01 00:00:10.000')
tdSql.checkData(6, 0, '2020-02-01 00:00:11.000')
tdSql.checkData(7, 0, '2020-02-01 00:00:12.000')
tdSql.checkData(8, 0, '2020-02-01 00:00:13.000')
tdSql.checkData(9, 0, '2020-02-01 00:00:14.000')
tdSql.checkData(10, 0, '2020-02-01 00:00:15.000')
tdSql.query(f"select _irowts,interp(c0) from {dbname}.{tbname} range('2020-02-01 00:00:05', '2020-02-01 00:00:15') every(2s) fill(linear)")
tdSql.checkRows(6)
tdSql.checkCols(2)
tdSql.checkData(0, 0, '2020-02-01 00:00:05.000')
tdSql.checkData(1, 0, '2020-02-01 00:00:07.000')
tdSql.checkData(2, 0, '2020-02-01 00:00:09.000')
tdSql.checkData(3, 0, '2020-02-01 00:00:11.000')
tdSql.checkData(4, 0, '2020-02-01 00:00:13.000')
tdSql.checkData(5, 0, '2020-02-01 00:00:15.000')
return
tdLog.printNoPrefix("==========step8:test intra block interpolation")
tdLog.printNoPrefix("==========step9:test intra block interpolation")
tdSql.execute(f"drop database {dbname}");
tdSql.prepare()
......@@ -551,7 +770,7 @@ class TDTestCase:
tdSql.checkData(0, 0, 15)
tdSql.checkData(1, 0, 15)
tdLog.printNoPrefix("==========step9:test multi-interp cases")
tdLog.printNoPrefix("==========step10:test multi-interp cases")
tdSql.query(f"select interp(c0),interp(c1),interp(c2),interp(c3) from {dbname}.{tbname} range('2020-02-09 00:00:05', '2020-02-13 00:00:05') every(1d) fill(null)")
tdSql.checkRows(5)
tdSql.checkCols(4)
......@@ -601,7 +820,7 @@ class TDTestCase:
for i in range (tdSql.queryCols):
tdSql.checkData(0, i, 13)
tdLog.printNoPrefix("==========step10:test error cases")
tdLog.printNoPrefix("==========step11:test error cases")
tdSql.error(f"select interp(c0) from {dbname}.{tbname}")
tdSql.error(f"select interp(c0) from {dbname}.{tbname} range('2020-02-10 00:00:05', '2020-02-15 00:00:05')")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册