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

add more cases

上级 5a1681d9
......@@ -24,6 +24,7 @@ class TDTestCase:
ctbname1 = "ctb1"
ctbname2 = "ctb2"
ctbname3 = "ctb3"
num_of_ctables = 3
tdSql.prepare()
......@@ -2401,7 +2402,7 @@ class TDTestCase:
tdLog.printNoPrefix("==========step13:stable cases")
tdLog.printNoPrefix("==========step13:test stable cases")
# select interp from supertable
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(null)")
......@@ -2527,39 +2528,380 @@ class TDTestCase:
tdSql.checkData(15, 2, 16)
tdSql.checkData(16, 2, 17)
# select interp from supertable partition by
# select interp from supertable partition by tbname
tdSql.query(f"select tbname, _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(null)")
point_idx = {1, 7, 13, 22, 28, 34, 43, 49, 55}
point_dict = {1:1, 7:7, 13:13, 22:3, 28:9, 34:15, 43:5, 49:11, 55:17}
rows_per_partition = 19
tdSql.checkRows(rows_per_partition * num_of_ctables)
for i in range(num_of_ctables):
for j in range(rows_per_partition):
row = j + i * rows_per_partition
tdSql.checkData(row, 0, f'ctb{i + 1}')
tdSql.checkData(j, 1, f'2020-02-01 00:00:{j}.000')
if row in point_idx:
tdSql.checkData(row, 2, False)
else:
tdSql.checkData(row, 2, True)
if row in point_idx:
tdSql.checkData(row, 3, point_dict[row])
else:
tdSql.checkData(row, 3, None)
tdSql.query(f"select tbname, _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(value, 0)")
point_idx = {1, 7, 13, 22, 28, 34, 43, 49, 55}
point_dict = {1:1, 7:7, 13:13, 22:3, 28:9, 34:15, 43:5, 49:11, 55:17}
rows_per_partition = 19
tdSql.checkRows(rows_per_partition * num_of_ctables)
for i in range(num_of_ctables):
for j in range(rows_per_partition):
row = j + i * rows_per_partition
tdSql.checkData(row, 0, f'ctb{i + 1}')
tdSql.checkData(j, 1, f'2020-02-01 00:00:{j}.000')
if row in point_idx:
tdSql.checkData(row, 2, False)
else:
tdSql.checkData(row, 2, True)
if row in point_idx:
tdSql.checkData(row, 3, point_dict[row])
else:
tdSql.checkData(row, 3, 0)
tdSql.query(f"select tbname, _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(prev)")
tdSql.checkRows(48)
for i in range(0, 18):
tdSql.checkData(i, 0, 'ctb1')
for i in range(18, 34):
tdSql.checkData(i, 0, 'ctb2')
for i in range(34, 48):
tdSql.checkData(i, 0, 'ctb3')
tdSql.checkData(0, 1, '2020-02-01 00:00:01.000')
tdSql.checkData(17, 1, '2020-02-01 00:00:18.000')
tdSql.checkData(18, 1, '2020-02-01 00:00:03.000')
tdSql.checkData(33, 1, '2020-02-01 00:00:18.000')
tdSql.checkData(34, 1, '2020-02-01 00:00:05.000')
tdSql.checkData(47, 1, '2020-02-01 00:00:18.000')
for i in range(0, 6):
tdSql.checkData(i, 3, 1)
for i in range(6, 12):
tdSql.checkData(i, 3, 7)
for i in range(12, 18):
tdSql.checkData(i, 3, 13)
for i in range(18, 24):
tdSql.checkData(i, 3, 3)
for i in range(24, 30):
tdSql.checkData(i, 3, 9)
for i in range(30, 34):
tdSql.checkData(i, 3, 15)
for i in range(34, 40):
tdSql.checkData(i, 3, 5)
for i in range(40, 46):
tdSql.checkData(i, 3, 11)
for i in range(46, 48):
tdSql.checkData(i, 3, 17)
tdSql.query(f"select tbname, _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(next)")
tdSql.checkRows(48)
for i in range(0, 14):
tdSql.checkData(i, 0, 'ctb1')
for i in range(14, 30):
tdSql.checkData(i, 0, 'ctb2')
for i in range(30, 48):
tdSql.checkData(i, 0, 'ctb3')
tdSql.checkData(0, 1, '2020-02-01 00:00:00.000')
tdSql.checkData(13, 1, '2020-02-01 00:00:13.000')
tdSql.checkData(14, 1, '2020-02-01 00:00:00.000')
tdSql.checkData(29, 1, '2020-02-01 00:00:15.000')
tdSql.checkData(30, 1, '2020-02-01 00:00:00.000')
tdSql.checkData(47, 1, '2020-02-01 00:00:17.000')
for i in range(0, 2):
tdSql.checkData(i, 3, 1)
for i in range(2, 8):
tdSql.checkData(i, 3, 7)
for i in range(8, 14):
tdSql.checkData(i, 3, 13)
for i in range(14, 18):
tdSql.checkData(i, 3, 3)
for i in range(18, 24):
tdSql.checkData(i, 3, 9)
for i in range(24, 30):
tdSql.checkData(i, 3, 15)
for i in range(30, 36):
tdSql.checkData(i, 3, 5)
for i in range(36, 42):
tdSql.checkData(i, 3, 11)
for i in range(42, 48):
tdSql.checkData(i, 3, 17)
tdSql.query(f"select tbname, _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear)")
tdSql.checkRows(39)
for i in range(0, 13):
tdSql.checkData(i, 0, 'ctb1')
for i in range(13, 26):
tdSql.checkData(i, 0, 'ctb2')
for i in range(26, 39):
tdSql.checkData(i, 0, 'ctb3')
tdSql.checkData(0, 1, '2020-02-01 00:00:01.000')
tdSql.checkData(12, 1, '2020-02-01 00:00:13.000')
tdSql.checkData(13, 1, '2020-02-01 00:00:03.000')
tdSql.checkData(25, 1, '2020-02-01 00:00:15.000')
tdSql.checkData(26, 1, '2020-02-01 00:00:05.000')
tdSql.checkData(38, 1, '2020-02-01 00:00:17.000')
for i in range(0, 13):
tdSql.checkData(i, 3, i + 1)
for i in range(13, 26):
tdSql.checkData(i, 3, i - 10)
for i in range(26, 39):
tdSql.checkData(i, 3, i - 21)
# select interp from supertable partition by column
tdSql.query(f"select c0, _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by c0 range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(null)")
tdSql.checkRows(171)
tdSql.query(f"select c0, _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by c0 range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(value, 0)")
tdSql.checkRows(171)
tdSql.query(f"select c0, _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by c0 range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(prev)")
tdSql.checkRows(90)
tdSql.query(f"select c0, _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by c0 range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(next)")
tdSql.checkRows(90)
tdSql.query(f"select c0, _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by c0 range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear)")
tdSql.checkRows(9)
# select interp from supertable partition by tag
tdSql.query(f"select t1, _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by t1 range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(null)")
tdSql.checkRows(57)
tdSql.checkData(0, 2, None)
tdSql.checkData(1, 2, 1)
tdSql.checkData(2, 2, None)
tdSql.checkData(3, 2, 3)
tdSql.checkData(4, 2, None)
tdSql.checkData(5, 2, 5)
tdSql.checkData(6, 2, None)
tdSql.checkData(7, 2, 7)
tdSql.checkData(8, 2, None)
tdSql.checkData(9, 2, 9)
tdSql.checkData(10, 2, None)
tdSql.checkData(11, 2, 11)
tdSql.checkData(12, 2, None)
tdSql.checkData(13, 2, 13)
tdSql.checkData(14, 2, None)
tdSql.checkData(15, 2, 15)
tdSql.checkData(16, 2, None)
tdSql.checkData(17, 2, 17)
tdSql.checkData(18, 2, None)
tdSql.query(f"select t1, _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by t1 range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(value, 0)")
tdSql.checkRows(57)
tdSql.query(f"select t1, _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by t1 range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(prev)")
tdSql.checkRows(48)
tdSql.query(f"select t1, _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by t1 range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(next)")
tdSql.checkRows(48)
tdSql.query(f"select t1, _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by t1 range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear)")
tdSql.checkRows(39)
# select interp from supertable filter
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} where ts between '2020-02-01 00:00:01.000' and '2020-02-01 00:00:13.000' range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear)")
tdSql.checkRows(13)
for i in range(13):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} where c0 <= 13 range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear)")
tdSql.checkRows(13)
for i in range(13):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} where t1 = 1 range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear)")
tdSql.checkRows(13)
for i in range(13):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} where tbname = 'ctb1' range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear)")
tdSql.checkRows(13)
for i in range(13):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} where ts between '2020-02-01 00:00:01.000' and '2020-02-01 00:00:13.000' partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear)")
tdSql.checkRows(27)
for i in range(13):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} where c0 <= 13 partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear)")
tdSql.checkRows(27)
for i in range(13):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} where t1 = 1 partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear)")
tdSql.checkRows(13)
for i in range(13):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} where tbname = 'ctb1' partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear)")
tdSql.checkRows(13)
for i in range(13):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
# select interp from supertable filter limit
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear) limit 13")
tdSql.checkRows(13)
#tdSql.query(f"select interp(c0) from {dbname}.{ctbname1} range('2020-02-01 00:00:04', '2020-02-01 00:00:16') every(1s) fill(null)")
#tdSql.checkRows(13)
for i in range(13):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear) limit 20")
tdSql.checkRows(17)
for i in range(17):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} where ts between '2020-02-01 00:00:01.000' and '2020-02-01 00:00:13.000' range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear) limit 10")
tdSql.checkRows(10)
for i in range(10):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} where c0 <= 13 range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear) limit 10")
tdSql.checkRows(10)
for i in range(10):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} where t1 = 1 range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear) limit 10")
tdSql.checkRows(10)
for i in range(10):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} where tbname = 'ctb1' range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear) limit 10")
tdSql.checkRows(10)
for i in range(10):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear) limit 13")
tdSql.checkRows(13)
for i in range(13):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear) limit 40")
tdSql.checkRows(39)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} where ts between '2020-02-01 00:00:01.000' and '2020-02-01 00:00:13.000' partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear) limit 10")
tdSql.checkRows(10)
for i in range(10):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} where c0 <= 13 partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear) limit 10")
tdSql.checkRows(10)
for i in range(10):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} where t1 = 1 partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear) limit 10")
tdSql.checkRows(10)
for i in range(10):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
tdSql.query(f"select _irowts, _isfilled, interp(c0) from {dbname}.{stbname} where tbname = 'ctb1' partition by tbname range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear) limit 10")
tdSql.checkRows(10)
for i in range(10):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 1)
# select interp from supertable with scalar expression
tdSql.query(f"select _irowts, _isfilled, interp(1 + 1) from {dbname}.{stbname} range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear)")
tdSql.checkRows(17)
for i in range(17):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, 2.0)
tdSql.query(f"select _irowts, _isfilled, interp(c0 + 1) from {dbname}.{stbname} range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear)")
tdSql.checkRows(17)
for i in range(17):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, i + 2)
tdSql.query(f"select _irowts, _isfilled, interp(c0 * 2) from {dbname}.{stbname} range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear)")
tdSql.checkRows(17)
for i in range(17):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, (i + 1) * 2)
tdSql.query(f"select _irowts, _isfilled, interp(c0 + c1) from {dbname}.{stbname} range('2020-02-01 00:00:00', '2020-02-01 00:00:18') every(1s) fill(linear)")
tdSql.checkRows(17)
#tdSql.error(f"select interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:04', '2020-02-02 00:00:16') every(1s) fill(null)")
#tdSql.checkRows(13)
for i in range(17):
tdSql.checkData(i, 0, f'2020-02-01 00:00:{i + 1}.000')
tdSql.checkData(i, 2, (i + 1) * 2)
#tdSql.query(f"select _irowts,interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:04', '2020-02-02 00:00:16') every(1h) fill(prev)")
#tdSql.query(f"select tbname,_irowts,interp(c0) from {dbname}.{stbname} partition by tbname range('2020-02-01 00:00:04', '2020-02-02 00:00:16') every(1h) fill(prev)")
tdLog.printNoPrefix("======step 14: test interp pseudo columns")
tdSql.error(f"select _irowts, c6 from {dbname}.{tbname}")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册