Merge pull request #24745 from taosdata/ts4467
add test case for task ts-4467
This commit is contained in:
commit
e207cd80b2
|
@ -575,6 +575,7 @@
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ts_3405_3398_3423.py -N 3 -n 3
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ts_3405_3398_3423.py -N 3 -n 3
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ts-4348-td-27939.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/ts-4348-td-27939.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/backslash_g.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/backslash_g.py
|
||||||
|
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/test_ts4467.py
|
||||||
|
|
||||||
,,n,system-test,python3 ./test.py -f 2-query/queryQnode.py
|
,,n,system-test,python3 ./test.py -f 2-query/queryQnode.py
|
||||||
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode1mnode.py
|
,,y,system-test,./pytest.sh python3 ./test.py -f 6-cluster/5dnode1mnode.py
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
import random
|
||||||
|
import itertools
|
||||||
|
from util.log import *
|
||||||
|
from util.cases import *
|
||||||
|
from util.sql import *
|
||||||
|
from util.sqlset import *
|
||||||
|
from util import constant
|
||||||
|
from util.common import *
|
||||||
|
|
||||||
|
|
||||||
|
class TDTestCase:
|
||||||
|
"""Verify the jira TS-4467
|
||||||
|
"""
|
||||||
|
def init(self, conn, logSql, replicaVar=1):
|
||||||
|
self.replicaVar = int(replicaVar)
|
||||||
|
tdLog.debug("start to execute %s" % __file__)
|
||||||
|
tdSql.init(conn.cursor())
|
||||||
|
|
||||||
|
def prepareData(self):
|
||||||
|
# db
|
||||||
|
tdSql.execute("create database if not exists db")
|
||||||
|
tdSql.execute("use db")
|
||||||
|
|
||||||
|
# table
|
||||||
|
tdSql.execute("create table t (ts timestamp, c1 varchar(16));")
|
||||||
|
|
||||||
|
# insert data
|
||||||
|
sql = "insert into t values"
|
||||||
|
for i in range(6):
|
||||||
|
sql += f"(now+{str(i+1)}s, '{'name' + str(i+1)}')"
|
||||||
|
sql += ";"
|
||||||
|
tdSql.execute(sql)
|
||||||
|
tdLog.debug("insert data successfully")
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
self.prepareData()
|
||||||
|
|
||||||
|
# join query with order by
|
||||||
|
sql = "select * from t t1, (select * from t order by ts limit 5) t2 where t1.ts = t2.ts;"
|
||||||
|
tdSql.query(sql)
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
|
||||||
|
sql = "select * from t t1, (select * from t order by ts desc limit 5) t2 where t1.ts = t2.ts;"
|
||||||
|
tdSql.query(sql)
|
||||||
|
tdSql.checkRows(5)
|
||||||
|
|
||||||
|
sql = "select * from t t1, (select * from t order by ts limit 5) t2 where t1.ts = t2.ts order by t1.ts;"
|
||||||
|
tdSql.query(sql)
|
||||||
|
res1 = tdSql.queryResult
|
||||||
|
tdLog.debug("res1: %s" % str(res1))
|
||||||
|
|
||||||
|
sql = "select * from t t1, (select * from t order by ts limit 5) t2 where t1.ts = t2.ts order by t1.ts desc;"
|
||||||
|
tdSql.query(sql)
|
||||||
|
res2 = tdSql.queryResult
|
||||||
|
tdLog.debug("res2: %s" % str(res2))
|
||||||
|
assert(len(res1) == len(res2) and res1[0][0] == res2[4][0])
|
||||||
|
|
||||||
|
def stop(self):
|
||||||
|
tdSql.close()
|
||||||
|
tdLog.success("%s successfully executed" % __file__)
|
||||||
|
|
||||||
|
tdCases.addWindows(__file__, TDTestCase())
|
||||||
|
tdCases.addLinux(__file__, TDTestCase())
|
Loading…
Reference in New Issue