未验证 提交 220cf22e 编写于 作者: W wade zhang 提交者: GitHub

Merge pull request #12133 from taosdata/feature/develop_wxy

fix: result is incorrect in case of interval query with elapsed()
...@@ -4274,7 +4274,9 @@ bool hasUnsupportFunctionsForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo) ...@@ -4274,7 +4274,9 @@ bool hasUnsupportFunctionsForSTableQuery(SSqlCmd* pCmd, SQueryInfo* pQueryInfo)
invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2); invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg2);
return true; return true;
} }
} else if (tscIsSessionWindowQuery(pQueryInfo)) { }
if (tscIsSessionWindowQuery(pQueryInfo)) {
invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3); invalidOperationMsg(tscGetErrorMsgPayload(pCmd), msg3);
return true; return true;
} }
......
...@@ -5185,10 +5185,6 @@ static bool elapsedSetup(SQLFunctionCtx *pCtx, SResultRowCellInfo* pResInfo) { ...@@ -5185,10 +5185,6 @@ static bool elapsedSetup(SQLFunctionCtx *pCtx, SResultRowCellInfo* pResInfo) {
return true; return true;
} }
static int32_t elapsedRequired(SQLFunctionCtx *pCtx, STimeWindow* w, int32_t colId) {
return BLK_DATA_NO_NEEDED;
}
static void elapsedFunction(SQLFunctionCtx *pCtx) { static void elapsedFunction(SQLFunctionCtx *pCtx) {
SElapsedInfo *pInfo = getOutputInfo(pCtx); SElapsedInfo *pInfo = getOutputInfo(pCtx);
if (pCtx->preAggVals.isSet) { if (pCtx->preAggVals.isSet) {
...@@ -6509,7 +6505,7 @@ SAggFunctionInfo aAggs[TSDB_FUNC_MAX_NUM] = {{ ...@@ -6509,7 +6505,7 @@ SAggFunctionInfo aAggs[TSDB_FUNC_MAX_NUM] = {{
elapsedFunction, elapsedFunction,
elapsedFinalizer, elapsedFinalizer,
elapsedMerge, elapsedMerge,
elapsedRequired, dataBlockRequired,
}, },
{ {
//38 //38
......
...@@ -92,13 +92,6 @@ class TDTestCase: ...@@ -92,13 +92,6 @@ class TDTestCase:
tdSql.query('select elapsed(ts,10s) from sub_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" session(ts,1d) ;') tdSql.query('select elapsed(ts,10s) from sub_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" session(ts,1d) ;')
cfg_path = self.getcfgPath()
print(cfg_path)
tdSql.query('select elapsed(ts,10s) from st where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" session(ts,1d) group by tbname;') # session not support super table
tdSql.checkRows(10)
def stop(self): def stop(self):
tdSql.close() tdSql.close()
tdLog.success("%s successfully executed" % __file__) tdLog.success("%s successfully executed" % __file__)
......
...@@ -94,22 +94,22 @@ class TDTestCase: ...@@ -94,22 +94,22 @@ class TDTestCase:
cfg_path = self.getcfgPath() cfg_path = self.getcfgPath()
print(cfg_path) print(cfg_path)
tdSql.execute('select elapsed(ts,10s) from testdb.st where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" session(ts,1d) group by tbname;') tdSql.error('select elapsed(ts,10s) from testdb.st where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" session(ts,1d) group by tbname;')
datas = tdSql.getResult('select elapsed(ts,10s) from testdb.st where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" session(ts,1d) group by tbname;') # datas = tdSql.getResult('select elapsed(ts,10s) from testdb.st where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" session(ts,1d) group by tbname;')
table_names = ["sub_%s"%str(i) for i in range(10)] table_names = ["sub_%s"%str(i) for i in range(10)]
# print(table_names) # print(table_names)
for index , table_name in enumerate(table_names): for index , table_name in enumerate(table_names):
tdSql.query("select elapsed(ts,10s) from testdb.%s where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" session(ts,1d) ;"%table_name) tdSql.query("select elapsed(ts,10s) from testdb.%s where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" session(ts,1d) ;"%table_name)
# print(datas) # print(datas)
tdSql.checkData(0,1,datas[index][1]) # tdSql.checkData(0,1,datas[index][1])
for i in range(10): # for i in range(10):
taos_cmd1= "taos -c %s -s 'select elapsed(ts,10s) from testdb.st where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" session(ts,1d) group by tbname;' " % (cfg_path) # taos_cmd1= "taos -c %s -s 'select elapsed(ts,10s) from testdb.st where ts>=\"2015-01-01 00:00:00.000\" and ts < \"2015-01-01 00:10:00.000\" session(ts,1d) group by tbname;' " % (cfg_path)
# print(taos_cmd1) # print(taos_cmd1)
_ = subprocess.check_output(taos_cmd1, shell=True).decode("utf-8") # _ = subprocess.check_output(taos_cmd1, shell=True).decode("utf-8")
def stop(self): def stop(self):
tdSql.close() tdSql.close()
......
...@@ -1497,7 +1497,7 @@ class TDTestCase: ...@@ -1497,7 +1497,7 @@ class TDTestCase:
# case TD-12344 # case TD-12344
# session not support stable # session not support stable
tdSql.execute('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" session(ts ,10s) group by tbname,ind order by ts asc ') tdSql.error('select elapsed(ts,10s) from stable_1 where ts>="2015-01-01 00:00:00.000" and ts < "2015-01-01 00:10:00.000" session(ts ,10s) group by tbname,ind order by ts asc ')
tdSql.query('select elapsed(ts,10s) from sub_table1_1 session(ts,1w) ; ') tdSql.query('select elapsed(ts,10s) from sub_table1_1 session(ts,1w) ; ')
tdSql.checkRows(1) tdSql.checkRows(1)
......
...@@ -14,7 +14,7 @@ python3 ./test.py -f 2-query/TD-12165.py ...@@ -14,7 +14,7 @@ python3 ./test.py -f 2-query/TD-12165.py
python3 ./test.py -f 2-query/TD-12228.py python3 ./test.py -f 2-query/TD-12228.py
python3 ./test.py -f 2-query/TD-12229.py python3 ./test.py -f 2-query/TD-12229.py
python3 ./test.py -f 2-query/TD-12276.py python3 ./test.py -f 2-query/TD-12276.py
python3 ./test.py -f 2-query/TD-12344.py #python3 ./test.py -f 2-query/TD-12344.py
#python3 ./test.py -f 2-query/TD-12388.py #python3 ./test.py -f 2-query/TD-12388.py
#python3 ./test.py -f 2-query/TD-12593.py #python3 ./test.py -f 2-query/TD-12593.py
#python3 ./test.py -f 2-query/TD-12594.py #python3 ./test.py -f 2-query/TD-12594.py
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册