提交 939ff45d 编写于 作者: X Xiaoyu Wang

[TD-10986]<feature>: perfect auto test case

上级 9dfce52a
......@@ -7576,7 +7576,7 @@ int32_t doFunctionsCompatibleCheck(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, char*
int32_t validateFunctionFromUpstream(SQueryInfo* pQueryInfo, char* msg) {
const char* msg1 = "TWA/Diff/Derivative/Irate are not allowed to apply to super table without group by tbname";
const char* msg1 = "TWA/Diff/Derivative/Irate/elapsed are not allowed to apply to super table without group by tbname";
const char* msg2 = "group by not supported in nested interp query";
const char* msg3 = "order by not supported in nested interp query";
const char* msg4 = "first column should be timestamp for interp query";
......@@ -7589,7 +7589,7 @@ int32_t validateFunctionFromUpstream(SQueryInfo* pQueryInfo, char* msg) {
SExprInfo* pExpr = tscExprGet(pQueryInfo, i);
int32_t f = pExpr->base.functionId;
if (f == TSDB_FUNC_DERIVATIVE || f == TSDB_FUNC_TWA || f == TSDB_FUNC_IRATE || f == TSDB_FUNC_DIFF) {
if (f == TSDB_FUNC_DERIVATIVE || f == TSDB_FUNC_TWA || f == TSDB_FUNC_IRATE || f == TSDB_FUNC_DIFF || f == TSDB_FUNC_ELAPSED) {
for (int32_t j = 0; j < upNum; ++j) {
SQueryInfo* pUp = taosArrayGetP(pQueryInfo->pUpstream, j);
STableMetaInfo *pTableMetaInfo = tscGetMetaInfo(pUp, 0);
......
......@@ -50,6 +50,9 @@ class TDTestCase:
tdSql.query("select count(*) from t1")
tdSql.checkEqual(int(tdSql.getData(0, 0)), 1000)
# empty normal table
tdSql.execute("create table t2(ts timestamp, i int, b bigint, f float, d double, bin binary(10), s smallint, t tinyint, bl bool, n nchar(10), ts1 timestamp)")
tdSql.execute("create database wxy_db_ns precision \"ns\"")
tdSql.execute("use wxy_db_ns")
tdSql.execute("create table t1 (ts timestamp, f float)")
......@@ -73,6 +76,12 @@ class TDTestCase:
tdSql.checkEqual(int(tdSql.getData(0, 0)), 500)
tdSql.query("select count(*) from st1s2")
tdSql.checkEqual(int(tdSql.getData(0, 0)), 500)
# empty super table
tdSql.execute("create stable st2(ts timestamp, i int, b bigint, f float, d double, bin binary(10), s smallint, t tinyint, bl bool, n nchar(10), ts1 timestamp) tags(id int)")
tdSql.execute("create table st2s1 using st1 tags(1)")
tdSql.execute("create table st2s2 using st1 tags(2)")
tdSql.execute("create stable st3(ts timestamp, i int, b bigint, f float, d double, bin binary(10), s smallint, t tinyint, bl bool, n nchar(10), ts1 timestamp) tags(id int)")
def run(self):
tdSql.prepare()
......
......@@ -72,6 +72,10 @@ class ElapsedCase:
tdSql.checkCols(6) # append tbname
tdSql.checkEqual(int(tdSql.getData(0, 2)), 0)
tdSql.query("select elapsed(ts), tbname from st1 where ts > '2021-11-22 00:00:00' and ts < '2021-11-23 00:00:00' group by tbname")
tdSql.checkRows(2)
tdSql.checkCols(3) # additional append tbname
tdSql.execute("use wxy_db_ns")
tdSql.query("select elapsed(ts, 1b), elapsed(ts, 1u) from t1")
tdSql.checkRows(1)
......@@ -267,7 +271,12 @@ class ElapsedCase:
self.fromCheck("select elapsed(ts) from %s where ts > '2021-11-22 00:00:00' and ts < '2021-11-23 00:00:00' interval(40s)", "t1")
tdSql.query("select * from (select elapsed(ts) from t1 interval(10s)) where ts > '2021-11-22 00:00:00' and ts < '2021-11-23 00:00:00'")
tdSql.query("select * from (select elapsed(ts) from t1)")
# empty table test
tdSql.checkEqual(tdSql.query("select elapsed(ts) from t2"), 0)
tdSql.checkEqual(tdSql.query("select elapsed(ts) from st2 group by tbname"), 0)
tdSql.checkEqual(tdSql.query("select elapsed(ts) from st3 group by tbname"), 0)
# Tags not allowed for table query, so there is no need to test super table.
tdSql.error("select elapsed(ts) from (select * from st1)")
def joinCheck(self, sqlTemplate, rtable):
tdSql.checkEqual(tdSql.getResult(sqlTemplate % (rtable, "")), tdSql.getResult(sqlTemplate % ("t1, %s t2" % rtable, "t1.ts = t2.ts and ")))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册