提交 1476e34e 编写于 作者: X Xiaoyu Wang

fix: result is incorrect in case of interval query with elapsed()

上级 fd15fb41
......@@ -5186,14 +5186,17 @@ static bool elapsedSetup(SQLFunctionCtx *pCtx, SResultRowCellInfo* pResInfo) {
}
static int32_t elapsedRequired(SQLFunctionCtx *pCtx, STimeWindow* w, int32_t colId) {
return BLK_DATA_NO_NEEDED;
return BLK_DATA_ALL_NEEDED;
}
static void elapsedFunction(SQLFunctionCtx *pCtx) {
SElapsedInfo *pInfo = getOutputInfo(pCtx);
qDebug("%s pCtx->preAggVals.isSet = %d", __FUNCTION__, pCtx->preAggVals.isSet);
if (pCtx->preAggVals.isSet) {
qDebug("%s pInfo->min = %ld, statis = [%ld, %ld], win = [%ld, %ld], win2 = [%ld, %ld]", __FUNCTION__, pInfo->min,
pCtx->preAggVals.statis.min, pCtx->preAggVals.statis.max, pCtx->startTs, pCtx->endTs, pCtx->start.key, pCtx->end.key);
if (pInfo->min == MAX_TS_KEY) {
pInfo->min = pCtx->preAggVals.statis.min < pCtx->startTs ? pCtx->startTs : pCtx->preAggVals.statis.min;
pInfo->min = pCtx->preAggVals.statis.min;
pInfo->max = pCtx->preAggVals.statis.max;
} else {
if (pCtx->order == TSDB_ORDER_ASC) {
......
......@@ -1497,7 +1497,7 @@ class TDTestCase:
# case TD-12344
# 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.checkRows(1)
......
......@@ -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-12229.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-12593.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.
先完成此消息的编辑!
想要评论请 注册