提交 bc49ed2e 编写于 作者: D dapan1121

fix bugs and add test cases

上级 ba5d069a
......@@ -595,7 +595,7 @@ static void doMergeResultImpl(SMultiwayMergeInfo* pInfo, SQLFunctionCtx *pCtx, i
for (int32_t j = 0; j < numOfExpr; ++j) {
int32_t functionId = pCtx[j].functionId;
if (functionId == TSDB_FUNC_TAG_DUMMY || functionId == TSDB_FUNC_TS_DUMMY) {
if (functionId == TSDB_FUNC_TS_DUMMY) {
continue;
}
......
......@@ -367,7 +367,7 @@ bool tscIsPointInterpQuery(SQueryInfo* pQueryInfo) {
assert(pExpr != NULL);
int32_t functionId = pExpr->base.functionId;
if (functionId == TSDB_FUNC_TAG || functionId == TSDB_FUNC_TS || functionId == TSDB_FUNC_TS_DUMMY) {
if (functionId == TSDB_FUNC_TAG || functionId == TSDB_FUNC_TAG_DUMMY || functionId == TSDB_FUNC_TS || functionId == TSDB_FUNC_TS_DUMMY) {
continue;
}
......
......@@ -1257,7 +1257,7 @@ void doTimeWindowInterpolation(SOperatorInfo* pOperator, SOptrBasicInfo* pInfo,
int16_t index = pColIndex->colIndex;
SColumnInfoData *pColInfo = taosArrayGet(pDataBlock, index);
assert(pColInfo->info.colId == pColIndex->colId);
assert(pColInfo->info.colId <= TSDB_RES_COL_ID || (pColInfo->info.colId >= 0 && pColInfo->info.colId == pColIndex->colId));
double v1 = 0, v2 = 0, v = 0;
if (functionId == TSDB_FUNC_INTERP) {
......@@ -5924,7 +5924,9 @@ static bool doEveryInterpolation(SOperatorInfo* pOperatorInfo, SSDataBlock* pBlo
SQLFunctionCtx* pCtx = NULL;
for (int32_t i = 1; i < pOperatorInfo->numOfOutput; ++i) {
assert(pEveryInfo->binfo.pCtx[i].functionId == TSDB_FUNC_INTERP || pEveryInfo->binfo.pCtx[i].functionId == TSDB_FUNC_TS_DUMMY);
assert(pEveryInfo->binfo.pCtx[i].functionId == TSDB_FUNC_INTERP
|| pEveryInfo->binfo.pCtx[i].functionId == TSDB_FUNC_TS_DUMMY
|| pEveryInfo->binfo.pCtx[i].functionId == TSDB_FUNC_TAG_DUMMY);
if (pEveryInfo->binfo.pCtx[i].functionId == TSDB_FUNC_INTERP) {
pCtx = &pEveryInfo->binfo.pCtx[i];
......@@ -5971,6 +5973,10 @@ static bool doEveryInterpolation(SOperatorInfo* pOperatorInfo, SSDataBlock* pBlo
}
if (tsCols == NULL && pCtx->startTs > pEveryInfo->tableEndKey && ascQuery) {
if (pQueryAttr->range.ekey == INT64_MIN) {
goto group_finished_exit;
}
if (pQueryAttr->fillType == TSDB_FILL_NONE || pQueryAttr->fillType == TSDB_FILL_LINEAR || pQueryAttr->fillType == TSDB_FILL_NEXT) {
goto group_finished_exit;
}
......@@ -5978,7 +5984,7 @@ static bool doEveryInterpolation(SOperatorInfo* pOperatorInfo, SSDataBlock* pBlo
if (pQueryAttr->fillType == TSDB_FILL_PREV) {
TSKEY lastTs = *(TSKEY *) pRuntimeEnv->prevRow[0];
if (lastTs != INT64_MIN) {
doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pBlock->pDataBlock, lastTs, -1, INT64_MIN, 0, 0, RESULT_ROW_START_INTERP);
doTimeWindowInterpolation(pOperatorInfo, pOperatorInfo->info, pEveryInfo->binfo.pRes->pDataBlock, lastTs, -1, INT64_MIN, 0, 0, RESULT_ROW_START_INTERP);
} else {
goto group_finished_exit;
}
......@@ -6125,8 +6131,6 @@ static SSDataBlock* doTimeEvery(void* param, bool* newgroup) {
return pInfo->pRes;
}
assert(pEveryInfo->groupDone);
if (pRes->info.rows > 0) {
qDebug("2");
copyTsColoum(pRes, pInfo->pCtx, pOperator->numOfOutput);
......
......@@ -134,15 +134,15 @@ sql insert into tb4_0 values ('2021-10-20 10:04:55',55,55.0,55,55,55,55.0,false,
run general/parser/interp_full_test.sim
print ================== restart server to commit data into disk
system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 500
system sh/exec.sh -n dnode1 -s start
print ================== server restart completed
run general/parser/interp_full_test.sim
system sh/exec.sh -n dnode1 -s stop -x SIGINT
run general/parser/interp_full_test1.sim
run general/parser/interp_full_test2.sim
#print ================== restart server to commit data into disk
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
#sleep 500
#system sh/exec.sh -n dnode1 -s start
#print ================== server restart completed
#
#run general/parser/interp_full_test.sim
#
#system sh/exec.sh -n dnode1 -s stop -x SIGINT
sleep 100
sql connect
sql_error SELECT INTERP(c7) FROM tb1;
sql_error SELECT INTERP(c8) FROM tb1;
sql_error SELECT INTERP(c9) FROM tb1;
sql_error SELECT INTERP(c1,c8) FROM tb1;
sql_error SELECT INTERP(*) FROM tb1;
sql_error SELECT INTERP(c1),INTERP(c8) FROM tb1;
sql_error SELECT INTERP(c1),avg(c1) FROM tb1;
sql_error SELECT INTERP(c1),c1 FROM tb1;
sql_error SELECT INTERP(c1),top(c1,3) FROM tb1;
sql_error SELECT INTERP(c1),first(c1) FROM tb1;
sql_error SELECT INTERP(c1),count(c1) FROM tb1;
sql_error SELECT INTERP(c1),ceil(c1) FROM tb1;
sql_error SELECT c1,c2,interp(c1) FROM tb1;
sql_error SELECT INTERP(c1) FROM stb1;
sql_error SELECT interp(c1) FROM stb1 group by t1;
sql_error SELECT interp(c1) FROM stb1 group by tbname,t1;
sql_error SELECT interp(c1) FROM stb1 group by tbname,ts;
sql_error SELECT interp(c1) FROM stb1 group by tbname,c1;
sql_error SELECT INTERP(c1) FROM tb1 interval(1s);
sql_error SELECT avg(c1) FROM tb1 every(1s);
sql_error SELECT avg(c1) FROM tb1 range(0,1);
sql_error SELECT INTERP(c1) FROM tb1 STATE_WINDOW(c1);
sql_error SELECT INTERP(c1) FROM tb1 SESSION(ts,100s);
sql SELECT INTERP(c1) FROM tb1;
if $rows != 1 then
return -1
endi
if $data00 != @21-10-20 10:00:00.000@ then
return -1
endi
if $data01 != 0 then
return -1
endi
sql SELECT ts,INTERP(c1) FROM tb1;
if $rows != 1 then
return -1
endi
if $data00 != @21-10-20 10:00:00.000@ then
return -1
endi
if $data01 != @21-10-20 10:00:00.000@ then
return -1
endi
if $data02 != 0 then
return -1
endi
sql SELECT INTERP(c1) FROM tb1 where ts > '2021-10-20 10:00:03'
if $rows != 1 then
return -1
endi
if $data00 != @21-10-20 10:00:06.000@ then
return -1
endi
if $data01 != 6 then
return -1
endi
sql SELECT INTERP(c1) FROM tb1 every(1s);
if $rows != 7 then
return -1
endi
if $data00 != @21-10-20 10:00:00.000@ then
return -1
endi
if $data01 != 0 then
return -1
endi
if $data10 != @21-10-20 10:00:01.000@ then
return -1
endi
if $data11 != 1 then
return -1
endi
if $data20 != @21-10-20 10:00:03.000@ then
return -1
endi
if $data21 != 3 then
return -1
endi
if $data30 != @21-10-20 10:00:06.000@ then
return -1
endi
if $data31 != 6 then
return -1
endi
if $data40 != @21-10-20 10:00:10.000@ then
return -1
endi
if $data41 != 10 then
return -1
endi
if $data50 != @21-10-20 10:00:15.000@ then
return -1
endi
if $data51 != 15 then
return -1
endi
if $data60 != @21-10-20 10:00:21.000@ then
return -1
endi
if $data61 != 21 then
return -1
endi
sql SELECT INTERP(c1,c2,c3,c4,c6,c5) FROM tb1 every(1s);
if $rows != 7 then
return -1
endi
if $data00 != @21-10-20 10:00:00.000@ then
return -1
endi
if $data01 != 0 then
return -1
endi
if $data02 != 0.00000 then
return -1
endi
if $data03 != 0 then
return -1
endi
if $data04 != 0 then
return -1
endi
if $data05 != 0.000000000 then
return -1
endi
if $data06 != 0 then
return -1
endi
if $data10 != @21-10-20 10:00:01.000@ then
return -1
endi
if $data11 != 1 then
return -1
endi
if $data12 != 1.00000 then
return -1
endi
if $data13 != 1 then
return -1
endi
if $data14 != 1 then
return -1
endi
if $data15 != 1.000000000 then
return -1
endi
if $data16 != 1 then
return -1
endi
if $data20 != @21-10-20 10:00:03.000@ then
return -1
endi
if $data21 != 3 then
return -1
endi
if $data22 != 3.00000 then
return -1
endi
if $data23 != 3 then
return -1
endi
if $data24 != 3 then
return -1
endi
if $data25 != 3.000000000 then
return -1
endi
if $data26 != 3 then
return -1
endi
if $data30 != @21-10-20 10:00:06.000@ then
return -1
endi
if $data31 != 6 then
return -1
endi
if $data32 != 6.00000 then
return -1
endi
if $data33 != 6 then
return -1
endi
if $data34 != 6 then
return -1
endi
if $data35 != 6.000000000 then
return -1
endi
if $data36 != 6 then
return -1
endi
if $data40 != @21-10-20 10:00:10.000@ then
return -1
endi
if $data41 != 10 then
return -1
endi
if $data42 != 10.00000 then
return -1
endi
if $data43 != 10 then
return -1
endi
if $data44 != 10 then
return -1
endi
if $data45 != 10.000000000 then
return -1
endi
if $data46 != 10 then
return -1
endi
if $data50 != @21-10-20 10:00:15.000@ then
return -1
endi
if $data51 != 15 then
return -1
endi
if $data52 != 15.00000 then
return -1
endi
if $data53 != 15 then
return -1
endi
if $data54 != 15 then
return -1
endi
if $data55 != 15.000000000 then
return -1
endi
if $data56 != 15 then
return -1
endi
if $data60 != @21-10-20 10:00:21.000@ then
return -1
endi
if $data61 != 21 then
return -1
endi
if $data62 != 21.00000 then
return -1
endi
if $data63 != 21 then
return -1
endi
if $data64 != 21 then
return -1
endi
if $data65 != 21.000000000 then
return -1
endi
if $data66 != 21 then
return -1
endi
sql SELECT INTERP(c1),interp(c2),interp(c3) FROM tb1 every(1s);
if $rows != 7 then
return -1
endi
if $data00 != @21-10-20 10:00:00.000@ then
return -1
endi
if $data01 != 0 then
return -1
endi
if $data02 != 0.00000 then
return -1
endi
if $data03 != 0 then
return -1
endi
if $data10 != @21-10-20 10:00:01.000@ then
return -1
endi
if $data11 != 1 then
return -1
endi
if $data12 != 1.00000 then
return -1
endi
if $data13 != 1 then
return -1
endi
if $data20 != @21-10-20 10:00:03.000@ then
return -1
endi
if $data21 != 3 then
return -1
endi
if $data22 != 3.00000 then
return -1
endi
if $data23 != 3 then
return -1
endi
if $data30 != @21-10-20 10:00:06.000@ then
return -1
endi
if $data31 != 6 then
return -1
endi
if $data32 != 6.00000 then
return -1
endi
if $data33 != 6 then
return -1
endi
if $data40 != @21-10-20 10:00:10.000@ then
return -1
endi
if $data41 != 10 then
return -1
endi
if $data42 != 10.00000 then
return -1
endi
if $data43 != 10 then
return -1
endi
if $data50 != @21-10-20 10:00:15.000@ then
return -1
endi
if $data51 != 15 then
return -1
endi
if $data52 != 15.00000 then
return -1
endi
if $data53 != 15 then
return -1
endi
if $data60 != @21-10-20 10:00:21.000@ then
return -1
endi
if $data61 != 21 then
return -1
endi
if $data62 != 21.00000 then
return -1
endi
if $data63 != 21 then
return -1
endi
sql SELECT INTERP(c1),ts FROM tb1 every(1s);
if $rows != 7 then
return -1
endi
if $data00 != @21-10-20 10:00:00.000@ then
return -1
endi
if $data01 != 0 then
return -1
endi
if $data02 != @21-10-20 10:00:00.000@ then
return -1
endi
if $data10 != @21-10-20 10:00:01.000@ then
return -1
endi
if $data11 != 1 then
return -1
endi
if $data12 != @21-10-20 10:00:01.000@ then
return -1
endi
if $data20 != @21-10-20 10:00:03.000@ then
return -1
endi
if $data21 != 3 then
return -1
endi
if $data22 != @21-10-20 10:00:03.000@ then
return -1
endi
if $data30 != @21-10-20 10:00:06.000@ then
return -1
endi
if $data31 != 6 then
return -1
endi
if $data32 != @21-10-20 10:00:06.000@ then
return -1
endi
if $data40 != @21-10-20 10:00:10.000@ then
return -1
endi
if $data41 != 10 then
return -1
endi
if $data42 != @21-10-20 10:00:10.000@ then
return -1
endi
if $data50 != @21-10-20 10:00:15.000@ then
return -1
endi
if $data51 != 15 then
return -1
endi
if $data52 != @21-10-20 10:00:15.000@ then
return -1
endi
if $data60 != @21-10-20 10:00:21.000@ then
return -1
endi
if $data61 != 21 then
return -1
endi
if $data62 != @21-10-20 10:00:21.000@ then
return -1
endi
sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname;
if $rows != 21 then
return -1
endi
if $data00 != @21-10-20 10:00:00.000@ then
return -1
endi
if $data01 != 0 then
return -1
endi
if $data02 != tb1 then
return -1
endi
if $data10 != @21-10-20 10:00:01.000@ then
return -1
endi
if $data11 != 1 then
return -1
endi
if $data12 != tb1 then
return -1
endi
if $data20 != @21-10-20 10:00:03.000@ then
return -1
endi
if $data21 != 3 then
return -1
endi
if $data22 != tb1 then
return -1
endi
if $data30 != @21-10-20 10:00:06.000@ then
return -1
endi
if $data31 != 6 then
return -1
endi
if $data32 != tb1 then
return -1
endi
if $data40 != @21-10-20 10:00:10.000@ then
return -1
endi
if $data41 != 10 then
return -1
endi
if $data42 != tb1 then
return -1
endi
if $data50 != @21-10-20 10:00:15.000@ then
return -1
endi
if $data51 != 15 then
return -1
endi
if $data52 != tb1 then
return -1
endi
if $data60 != @21-10-20 10:00:21.000@ then
return -1
endi
if $data61 != 21 then
return -1
endi
if $data62 != tb1 then
return -1
endi
if $data70 != @21-10-20 10:00:00.000@ then
return -1
endi
if $data71 != 0 then
return -1
endi
if $data72 != tb2 then
return -1
endi
if $data80 != @21-10-20 10:00:02.000@ then
return -1
endi
if $data81 != 2 then
return -1
endi
if $data82 != tb2 then
return -1
endi
if $data90 != @21-10-20 10:00:04.000@ then
return -1
endi
if $data91 != 4 then
return -1
endi
if $data92 != tb2 then
return -1
endi
sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname limit 10;
sql SELECT INTERP(c1) FROM stb1 every(1s) group by tbname limit 10 offset 10;
sql SELECT INTERP(c1),t1,interp(c2),t2,interp(c3) FROM stb1 every(1s) group by tbname;
sql SELECT tbname,INTERP(c1),t1,interp(c2),t2,interp(c3) FROM stb1 every(1s) group by tbname;
SELECT INTERP(c1) FROM stb1 range('2021-10-20 10:00:00.000','2021-10-20 10:00:40.000') every(1s) fill(linear) group by tbname;
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册