mirror of
https://github.com/taosdata/TDengine
synced 2026-05-24 10:09:01 +00:00
59 lines
1.8 KiB
Python
59 lines
1.8 KiB
Python
from new_test_framework.utils import tdLog, tdSql, sc, clusterComCheck
|
|
|
|
|
|
class TestJoinInterval:
|
|
|
|
def setup_class(cls):
|
|
tdLog.debug(f"start to execute {__file__}")
|
|
|
|
def test_join_interval(self):
|
|
"""Join Test
|
|
|
|
1.
|
|
|
|
Catalog:
|
|
- Query:Join
|
|
|
|
Since: v3.0.0.0
|
|
|
|
Labels: common,ci
|
|
|
|
Jira: None
|
|
|
|
History:
|
|
- 2025-5-7 Simon Guan migrated from tsim/query/join_interval.sim
|
|
|
|
"""
|
|
|
|
tdLog.info(f"======== step create databases")
|
|
tdSql.execute(f"create database d1")
|
|
tdSql.execute(f"create database d2")
|
|
tdSql.execute(f"create table d1.t1(ts timestamp, i int) tags(t int);")
|
|
tdSql.execute(f"create table d2.t1(ts timestamp, i int);")
|
|
tdSql.execute(
|
|
f"insert into d1.t11 using d1.t1 tags(1) values(1500000000000, 0)(1500000000001, 1)(1500000000002,2)(1500000000003,3)(1500000000004,4)"
|
|
)
|
|
tdSql.execute(
|
|
f"insert into d1.t12 using d1.t1 tags(2) values(1500000000000, 0)(1500000000001, 1)(1500000000002,2)(1500000000003,3)(1500000000004,4)"
|
|
)
|
|
tdSql.execute(
|
|
f"insert into d1.t13 using d1.t1 tags(3) values(1500000000000, 0)(1500000000001, 1)(1500000000002,2)(1500000000003,3)(1500000000004,4)"
|
|
)
|
|
tdSql.execute(
|
|
f"insert into d2.t1 values(1500000000000,0)(1500000000001,1)(1500000000002,2)"
|
|
)
|
|
|
|
tdSql.query(
|
|
f"select _wstart,_wend,count((a.ts)),count(b.ts) from d1.t1 a, d2.t1 b where a.ts is not null and a.ts = b.ts interval(1a) ;"
|
|
)
|
|
tdSql.checkData(0, 2, 3)
|
|
|
|
tdSql.checkData(0, 3, 3)
|
|
|
|
tdSql.checkData(1, 2, 3)
|
|
|
|
tdSql.checkData(1, 3, 3)
|
|
|
|
tdSql.checkData(2, 2, 3)
|
|
|
|
tdSql.checkData(2, 3, 3)
|