diff --git a/src/query/src/qAggMain.c b/src/query/src/qAggMain.c index f3275456fc3c320ee127d6861ad1e212f4d08c60..fd8729e37925647279648ebd1bc4eadbdfa7feef 100644 --- a/src/query/src/qAggMain.c +++ b/src/query/src/qAggMain.c @@ -3734,6 +3734,10 @@ static void interp_function_impl(SQLFunctionCtx *pCtx) { } } } else { + if (GET_RES_INFO(pCtx)->numOfRes > 0) { + return; + } + // no data generated yet if (pCtx->size < 1) { return; @@ -3763,11 +3767,15 @@ static void interp_function_impl(SQLFunctionCtx *pCtx) { if (pCtx->size > 1) { ekey = GET_TS_DATA(pCtx, 1); if ((ascQuery && ekey < pCtx->startTs) || ((!ascQuery) && ekey > pCtx->startTs)) { + setNull(pCtx->pOutput, pCtx->inputType, pCtx->inputBytes); + SET_VAL(pCtx, 1, 1); return; } val = ((char*)pCtx->pInput) + pCtx->inputBytes; } else { + setNull(pCtx->pOutput, pCtx->inputType, pCtx->inputBytes); + SET_VAL(pCtx, 1, 1); return; } } else { @@ -3812,7 +3820,7 @@ static void interp_function_impl(SQLFunctionCtx *pCtx) { SET_VAL(pCtx, 1, 1); } -static void interp_function(SQLFunctionCtx *pCtx) { +static void interp_function(SQLFunctionCtx *pCtx) { // at this point, the value is existed, return directly if (pCtx->size > 0) { bool ascQuery = (pCtx->order == TSDB_ORDER_ASC); diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index fc4f6948ac49fd79bd848128f0da46a2a7f1f3a1..99e1f44ca54d2e9090c7b173b3002b22ca9033d5 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -757,6 +757,16 @@ static void setResultRowInterpo(SResultRow* pResult, SResultTsInterpType type) { } } +static void unsetResultRowInterpo(SResultRow* pResult, SResultTsInterpType type) { + assert(pResult != NULL && (type == RESULT_ROW_START_INTERP || type == RESULT_ROW_END_INTERP)); + if (type == RESULT_ROW_START_INTERP) { + pResult->startInterp = false; + } else { + pResult->endInterp = false; + } +} + + static bool resultRowInterpolated(SResultRow* pResult, SResultTsInterpType type) { assert(pResult != NULL && (type == RESULT_ROW_START_INTERP || type == RESULT_ROW_END_INTERP)); if (type == RESULT_ROW_START_INTERP) { @@ -1368,6 +1378,11 @@ static bool setTimeWindowInterpolationStartTs(SOperatorInfo* pOperatorInfo, SQLF bool ascQuery = QUERY_IS_ASC_QUERY(pQueryAttr); + if (pos < 0 && !ascQuery) { + setNotInterpoWindowKey(pCtx, pOperatorInfo->numOfOutput, RESULT_ROW_START_INTERP); + return true; + } + TSKEY curTs = tsCols[pos]; TSKEY lastTs = *(TSKEY *) pRuntimeEnv->prevRow[0]; @@ -1603,6 +1618,7 @@ static void hashAllIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pRe } int32_t startPos = ascQuery? 0 : (pSDataBlock->info.rows - 1); + int32_t ostartPos = 0; TSKEY ts = getStartTsKey(pQueryAttr, &pSDataBlock->info.window, tsCols, pSDataBlock->info.rows); STimeWindow win = getCurrentActiveTimeWindow(pResultRowInfo, ts, pQueryAttr); @@ -1611,7 +1627,7 @@ static void hashAllIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pRe SResultRow* pResult = NULL; int32_t forwardStep = 0; int32_t ret = 0; - STimeWindow preWin = win; + //STimeWindow preWin = win; while (1) { // null data, failed to allocate more memory buffer @@ -1625,11 +1641,17 @@ static void hashAllIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pRe forwardStep = getNumOfRowsInTimeWindow(pRuntimeEnv, &pSDataBlock->info, tsCols, startPos, ekey, binarySearchForKey, true); // window start(end) key interpolation + unsetResultRowInterpo(pResult, RESULT_ROW_START_INTERP); + ostartPos = startPos; + + if (!ascQuery) { + startPos += forwardStep * step; + } + doWindowBorderInterpolation(pOperatorInfo, pSDataBlock, pInfo->pCtx, pResult, &win, startPos, forwardStep); - doApplyFunctions(pRuntimeEnv, pInfo->pCtx, ascQuery ? &win : &preWin, startPos, forwardStep, tsCols, pSDataBlock->info.rows, numOfOutput); - preWin = win; + doApplyFunctions(pRuntimeEnv, pInfo->pCtx, &win, ostartPos, forwardStep, tsCols, pSDataBlock->info.rows, numOfOutput); - int32_t prevEndPos = (forwardStep - 1) * step + startPos; + int32_t prevEndPos = (!ascQuery) ? startPos - step : (forwardStep - 1) * step + startPos; startPos = getNextQualifiedWindow(pQueryAttr, &win, &pSDataBlock->info, tsCols, binarySearchForKey, prevEndPos); if (startPos < 0) { if ((ascQuery && win.skey <= pQueryAttr->window.ekey) || ((!ascQuery) && win.ekey >= pQueryAttr->window.ekey)) { @@ -1639,11 +1661,16 @@ static void hashAllIntervalAgg(SOperatorInfo* pOperatorInfo, SResultRowInfo* pRe longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_OUT_OF_MEMORY); } - startPos = pSDataBlock->info.rows - 1; + if (ascQuery) { + startPos = pSDataBlock->info.rows - 1; + } else { + startPos = 0; + } - // window start(end) key interpolation - doWindowBorderInterpolation(pOperatorInfo, pSDataBlock, pInfo->pCtx, pResult, &win, startPos, forwardStep); - doApplyFunctions(pRuntimeEnv, pInfo->pCtx, ascQuery ? &win : &preWin, startPos, forwardStep, tsCols, pSDataBlock->info.rows, numOfOutput); + forwardStep = 1; + unsetResultRowInterpo(pResult, RESULT_ROW_START_INTERP); + setNotInterpoWindowKey(pInfo->pCtx, pQueryAttr->numOfOutput, RESULT_ROW_START_INTERP); + doApplyFunctions(pRuntimeEnv, pInfo->pCtx, &win, startPos, forwardStep, tsCols, pSDataBlock->info.rows, numOfOutput); } break; diff --git a/src/query/src/qFill.c b/src/query/src/qFill.c index cdcc164152dddbc34d03508a2bdd7379d6e50892..144ca4dd794975a161d85c68e8058e3ca105d9c8 100644 --- a/src/query/src/qFill.c +++ b/src/query/src/qFill.c @@ -239,6 +239,9 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, void** data, int32_t outputR } else { setNull(output, pCol->col.type, pCol->col.bytes); } + if (!FILL_IS_ASC_FILL(pFillInfo)) { + memcpy(*prev + pCol->col.offset, output, pCol->col.bytes); + } } else { assignVal(output, (char*)&pCol->fillVal.i, pCol->col.bytes, pCol->col.type); } diff --git a/tests/script/fullGeneralSuite.sim b/tests/script/fullGeneralSuite.sim index 9f46b078475806292239e49fcbec80f5957e4eb4..37b1b4d973c26c1b2b37531f25f4d75b83b1f6c6 100644 --- a/tests/script/fullGeneralSuite.sim +++ b/tests/script/fullGeneralSuite.sim @@ -222,3 +222,4 @@ run general/stream/metrics_replica1_vnoden.sim run general/db/show_create_db.sim run general/db/show_create_table.sim run general/parser/like.sim +run general/parser/interp_blocks.sim diff --git a/tests/script/general/parser/interp_blocks.sim b/tests/script/general/parser/interp_blocks.sim new file mode 100644 index 0000000000000000000000000000000000000000..6099e8c77cf960985cf06888eba6e80d5ebc7188 --- /dev/null +++ b/tests/script/general/parser/interp_blocks.sim @@ -0,0 +1,753 @@ +system sh/stop_dnodes.sh + +system sh/deploy.sh -n dnode1 -i 1 +system sh/cfg.sh -n dnode1 -c walLevel -v 1 +system sh/cfg.sh -n dnode1 -c minRows -v 10 +system sh/exec.sh -n dnode1 -s start +sleep 100 +sql connect + +sql create database newplant; +print ====== create tables +sql use newplant +sql create table st_analogdef (ts TIMESTAMP,ip_value FLOAT,ip_quality TINYINT) TAGS (name NCHAR(50),st_type BINARY(10),st_plant_area NCHAR(10),st_description NCHAR(50),st_eng_units NCHAR(10),st_graph_maximum FLOAT,st_graph_minimum FLOAT,st_hh_limit FLOAT,st_h_limit FLOAT,st_l_limit FLOAT,st_ll_limit FLOAT,st_deadband FLOAT,is_sys_table INT); +sql CREATE TABLE ts_1171194 USING st_analogdef TAGS ("TD_A01009","analog","ss1","sss1009","%",30000.000000,NULL,12000.000000,10000.000000,100.000000,80.000000,NULL,0); + +sql insert into ts_1171194 values ('2021-08-16 16:09:40.000',1.00000,2) +sql insert into ts_1171194 values ('2021-08-16 16:10:10.000',2.00000,3) +sql insert into ts_1171194 values ('2021-08-16 16:10:40.000',3.00000,4) +sql insert into ts_1171194 values ('2021-08-16 16:11:10.000',4.00000,5) +sql insert into ts_1171194 values ('2021-08-16 16:11:40.000',5.00000,6) +sql insert into ts_1171194 values ('2021-08-16 16:12:10.000',6.00000,7) +sql insert into ts_1171194 values ('2021-08-16 16:12:40.000',7.00000,8) +sql insert into ts_1171194 values ('2021-08-16 16:13:20.000',8.00000,9) +sql insert into ts_1171194 values ('2021-08-16 16:13:50.000',9.00000,10) +sql insert into ts_1171194 values ('2021-08-16 16:58:00.000',10.00000,11) + +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 + +sql insert into ts_1171194 values ('2021-08-16 16:59:00.000',11.00000,12) +sql insert into ts_1171194 values ('2021-08-16 17:10:10.000',12.00000,13) +sql insert into ts_1171194 values ('2021-08-16 17:10:40.000',13.00000,14) +sql insert into ts_1171194 values ('2021-08-16 17:11:10.000',14.00000,15) +sql insert into ts_1171194 values ('2021-08-16 17:11:40.000',15.00000,16) +sql insert into ts_1171194 values ('2021-08-16 17:12:10.000',16.00000,17) +sql insert into ts_1171194 values ('2021-08-16 17:12:40.000',17.00000,18) +sql insert into ts_1171194 values ('2021-08-16 17:13:20.000',18.00000,19) +sql insert into ts_1171194 values ('2021-08-16 17:13:50.000',19.00000,20) +sql insert into ts_1171194 values ('2021-08-16 17:58:00.000',20.00000,21) + +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 + +sql insert into ts_1171194 values ('2021-08-16 17:59:00.000',21.00000,22) +sql insert into ts_1171194 values ('2021-08-16 18:10:10.000',22.00000,23) +sql insert into ts_1171194 values ('2021-08-16 18:10:40.000',23.00000,24) +sql insert into ts_1171194 values ('2021-08-16 18:11:10.000',24.00000,25) +sql insert into ts_1171194 values ('2021-08-16 18:11:40.000',25.00000,26) +sql insert into ts_1171194 values ('2021-08-16 18:12:10.000',26.00000,27) +sql insert into ts_1171194 values ('2021-08-16 18:12:40.000',27.00000,28) +sql insert into ts_1171194 values ('2021-08-16 18:13:20.000',28.00000,29) +sql insert into ts_1171194 values ('2021-08-16 18:13:50.000',29.00000,30) +sql insert into ts_1171194 values ('2021-08-16 18:58:00.000',30.00000,31) + + +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 + + +sql select interp(ip_value,ip_quality) from st_analogdef where name='TD_A01009' and ts >='2021-08-16 16:00:00.000' and ts <='2021-08-16 19:00:00.000' every(1h) fill(linear); +if $rows != 4 then + return -1 +endi +if $data00 != @21-08-16 16:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data02 != NULL then + return -1 +endi +if $data10 != @21-08-16 17:00:00.000@ then + return -1 +endi +if $data11 != 11.08955 then + return -1 +endi +if $data12 != 12 then + return -1 +endi +if $data20 != @21-08-16 18:00:00.000@ then + return -1 +endi +if $data21 != 21.08955 then + return -1 +endi +if $data22 != 22 then + return -1 +endi +if $data30 != @21-08-16 19:00:00.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data32 != NULL then + return -1 +endi + +sql select interp(ip_value,ip_quality) from st_analogdef where name='TD_A01009' and ts >='2021-08-16 16:00:00.000' and ts <='2021-08-16 19:00:00.000' every(30m) fill(linear); +if $rows != 7 then + return -1 +endi +if $data00 != @21-08-16 16:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data02 != NULL then + return -1 +endi +if $data10 != @21-08-16 16:30:00.000@ then + return -1 +endi +if $data11 != 9.36604 then + return -1 +endi +if $data12 != 10 then + return -1 +endi +if $data20 != @21-08-16 17:00:00.000@ then + return -1 +endi +if $data21 != 11.08955 then + return -1 +endi +if $data22 != 12 then + return -1 +endi +if $data30 != @21-08-16 17:30:00.000@ then + return -1 +endi +if $data31 != 19.36604 then + return -1 +endi +if $data32 != 20 then + return -1 +endi +if $data40 != @21-08-16 18:00:00.000@ then + return -1 +endi +if $data41 != 21.08955 then + return -1 +endi +if $data42 != 22 then + return -1 +endi +if $data50 != @21-08-16 18:30:00.000@ then + return -1 +endi +if $data51 != 29.36604 then + return -1 +endi +if $data52 != 30 then + return -1 +endi +if $data60 != @21-08-16 19:00:00.000@ then + return -1 +endi +if $data61 != NULL then + return -1 +endi +if $data62 != NULL then + return -1 +endi + +sql select interp(ip_value,ip_quality) from st_analogdef where name='TD_A01009' and ts >='2021-08-16 16:00:00.000' and ts <='2021-08-16 19:00:00.000' every(1h) fill(prev); +if $rows != 4 then + return -1 +endi +if $data00 != @21-08-16 16:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data02 != NULL then + return -1 +endi +if $data10 != @21-08-16 17:00:00.000@ then + return -1 +endi +if $data11 != 11.00000 then + return -1 +endi +if $data12 != 12 then + return -1 +endi +if $data20 != @21-08-16 18:00:00.000@ then + return -1 +endi +if $data21 != 21.00000 then + return -1 +endi +if $data22 != 22 then + return -1 +endi +if $data30 != @21-08-16 19:00:00.000@ then + return -1 +endi +if $data31 != 30.00000 then + return -1 +endi +if $data32 != 31 then + return -1 +endi + + +sql select interp(ip_value,ip_quality) from st_analogdef where name='TD_A01009' and ts >='2021-08-16 16:00:00.000' and ts <='2021-08-16 19:00:00.000' every(1h) fill(next); +if $rows != 4 then + return -1 +endi +if $data00 != @21-08-16 16:00:00.000@ then + return -1 +endi +if $data01 != 1.00000 then + return -1 +endi +if $data02 != 2 then + return -1 +endi +if $data10 != @21-08-16 17:00:00.000@ then + return -1 +endi +if $data11 != 12.00000 then + return -1 +endi +if $data12 != 13 then + return -1 +endi +if $data20 != @21-08-16 18:00:00.000@ then + return -1 +endi +if $data21 != 22.00000 then + return -1 +endi +if $data22 != 23 then + return -1 +endi +if $data30 != @21-08-16 19:00:00.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data32 != NULL then + return -1 +endi + +sql select interp(ip_value,ip_quality) from st_analogdef where name='TD_A01009' and ts >='2021-08-16 16:00:00.000' and ts <='2021-08-16 19:00:00.000' every(1h) fill(value,1); +if $rows != 4 then + return -1 +endi +if $data00 != @21-08-16 16:00:00.000@ then + return -1 +endi +if $data01 != 1.00000 then + return -1 +endi +if $data02 != 1 then + return -1 +endi +if $data10 != @21-08-16 17:00:00.000@ then + return -1 +endi +if $data11 != 1.00000 then + return -1 +endi +if $data12 != 1 then + return -1 +endi +if $data20 != @21-08-16 18:00:00.000@ then + return -1 +endi +if $data21 != 1.00000 then + return -1 +endi +if $data22 != 1 then + return -1 +endi +if $data30 != @21-08-16 19:00:00.000@ then + return -1 +endi +if $data31 != 1.00000 then + return -1 +endi +if $data32 != 1 then + return -1 +endi + +sql select interp(ip_value,ip_quality) from st_analogdef where name='TD_A01009' and ts >='2021-08-16 16:00:00.000' and ts <='2021-08-16 19:00:00.000' every(1h) fill(linear) order by ts desc; +if $rows != 4 then + return -1 +endi +if $data00 != @21-08-16 19:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data02 != NULL then + return -1 +endi +if $data10 != @21-08-16 18:00:00.000@ then + return -1 +endi +if $data11 != 21.08955 then + return -1 +endi +if $data12 != 22 then + return -1 +endi +if $data20 != @21-08-16 17:00:00.000@ then + return -1 +endi +if $data21 != 11.08955 then + return -1 +endi +if $data22 != 12 then + return -1 +endi +if $data30 != @21-08-16 16:00:00.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data32 != NULL then + return -1 +endi + +sql select interp(ip_value,ip_quality) from st_analogdef where name='TD_A01009' and ts >='2021-08-16 16:00:00.000' and ts <='2021-08-16 19:00:00.000' every(1h) fill(next) order by ts desc; +if $rows != 4 then + return -1 +endi +if $data00 != @21-08-16 19:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data02 != NULL then + return -1 +endi +if $data10 != @21-08-16 18:00:00.000@ then + return -1 +endi +if $data11 != 21.00000 then + return -1 +endi +if $data12 != 22 then + return -1 +endi +if $data20 != @21-08-16 17:00:00.000@ then + return -1 +endi +if $data21 != 11.00000 then + return -1 +endi +if $data22 != 12 then + return -1 +endi +if $data30 != @21-08-16 16:00:00.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data32 != NULL then + return -1 +endi + +sql select interp(ip_value,ip_quality) from st_analogdef where name='TD_A01009' and ts >='2021-08-16 16:00:00.000' and ts <='2021-08-16 19:00:00.000' every(1h) fill(NULL) order by ts desc; +if $rows != 4 then + return -1 +endi +if $data00 != @21-08-16 19:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data02 != NULL then + return -1 +endi +if $data10 != @21-08-16 18:00:00.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data12 != NULL then + return -1 +endi +if $data20 != @21-08-16 17:00:00.000@ then + return -1 +endi +if $data21 != NULL then + return -1 +endi +if $data22 != NULL then + return -1 +endi +if $data30 != @21-08-16 16:00:00.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data32 != NULL then + return -1 +endi + +sql select interp(ip_value,ip_quality) from st_analogdef where name='TD_A01009' and ts >='2021-08-16 16:00:00.000' and ts <='2021-08-16 19:00:00.000' every(1h) fill(value, 5) order by ts desc; +if $rows != 4 then + return -1 +endi +if $data00 != @21-08-16 19:00:00.000@ then + return -1 +endi +if $data01 != 5.00000 then + return -1 +endi +if $data02 != 5 then + return -1 +endi +if $data10 != @21-08-16 18:00:00.000@ then + return -1 +endi +if $data11 != 5.00000 then + return -1 +endi +if $data12 != 5 then + return -1 +endi +if $data20 != @21-08-16 17:00:00.000@ then + return -1 +endi +if $data21 != 5.00000 then + return -1 +endi +if $data22 != 5 then + return -1 +endi +if $data30 != @21-08-16 16:00:00.000@ then + return -1 +endi +if $data31 != 5.00000 then + return -1 +endi +if $data32 != 5 then + return -1 +endi + +sql select interp(ip_value,ip_quality) from st_analogdef where name='TD_A01009' and ts >='2021-08-16 16:00:00.000' and ts <='2021-08-16 19:00:00.000' every(30m) fill(linear) order by ts desc; +if $rows != 7 then + return -1 +endi +if $data00 != @21-08-16 19:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data02 != NULL then + return -1 +endi +if $data10 != @21-08-16 18:30:00.000@ then + return -1 +endi +if $data11 != 29.36604 then + return -1 +endi +if $data12 != 30 then + return -1 +endi +if $data20 != @21-08-16 18:00:00.000@ then + return -1 +endi +if $data21 != 21.08955 then + return -1 +endi +if $data22 != 22 then + return -1 +endi +if $data30 != @21-08-16 17:30:00.000@ then + return -1 +endi +if $data31 != 19.36604 then + return -1 +endi +if $data32 != 20 then + return -1 +endi +if $data40 != @21-08-16 17:00:00.000@ then + return -1 +endi +if $data41 != 11.08955 then + return -1 +endi +if $data42 != 12 then + return -1 +endi +if $data50 != @21-08-16 16:30:00.000@ then + return -1 +endi +if $data51 != 9.36604 then + return -1 +endi +if $data52 != 10 then + return -1 +endi +if $data60 != @21-08-16 16:00:00.000@ then + return -1 +endi +if $data61 != NULL then + return -1 +endi +if $data62 != NULL then + return -1 +endi + + +sql select interp(ip_value,ip_quality) from st_analogdef where name='TD_A01009' and ts >='2021-08-16 16:00:00.000' and ts <='2021-08-16 19:00:00.000' every(30m) fill(next) order by ts desc; +if $rows != 7 then + return -1 +endi +if $data00 != @21-08-16 19:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data02 != NULL then + return -1 +endi +if $data10 != @21-08-16 18:30:00.000@ then + return -1 +endi +if $data11 != 29.00000 then + return -1 +endi +if $data12 != 30 then + return -1 +endi +if $data20 != @21-08-16 18:00:00.000@ then + return -1 +endi +if $data21 != 21.00000 then + return -1 +endi +if $data22 != 22 then + return -1 +endi +if $data30 != @21-08-16 17:30:00.000@ then + return -1 +endi +if $data31 != 19.00000 then + return -1 +endi +if $data32 != 20 then + return -1 +endi +if $data40 != @21-08-16 17:00:00.000@ then + return -1 +endi +if $data41 != 11.00000 then + return -1 +endi +if $data42 != 12 then + return -1 +endi +if $data50 != @21-08-16 16:30:00.000@ then + return -1 +endi +if $data51 != 9.00000 then + return -1 +endi +if $data52 != 10 then + return -1 +endi +if $data60 != @21-08-16 16:00:00.000@ then + return -1 +endi +if $data61 != NULL then + return -1 +endi +if $data62 != NULL then + return -1 +endi + +sql select interp(ip_value,ip_quality) from st_analogdef where name='TD_A01009' and ts >='2021-08-16 16:00:00.000' and ts <='2021-08-16 16:13:50.000' every(3m) fill(linear); +if $rows != 5 then + return -1 +endi +if $data00 != @21-08-16 16:00:00.000@ then + return -1 +endi +if $data01 != NULL then + return -1 +endi +if $data02 != NULL then + return -1 +endi +if $data10 != @21-08-16 16:03:00.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data12 != NULL then + return -1 +endi +if $data20 != @21-08-16 16:06:00.000@ then + return -1 +endi +if $data21 != NULL then + return -1 +endi +if $data22 != NULL then + return -1 +endi +if $data30 != @21-08-16 16:09:00.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data32 != NULL then + return -1 +endi +if $data40 != @21-08-16 16:12:00.000@ then + return -1 +endi +if $data41 != 5.66667 then + return -1 +endi +if $data42 != 6 then + return -1 +endi + +sql select interp(ip_value,ip_quality) from st_analogdef where name='TD_A01009' and ts >='2021-08-16 16:00:00.000' and ts <='2021-08-16 16:13:50.000' every(3m) fill(linear) order by ts desc; +if $rows != 5 then + return -1 +endi +if $data00 != @21-08-16 16:12:00.000@ then + return -1 +endi +if $data01 != 5.66667 then + return -1 +endi +if $data02 != 6 then + return -1 +endi +if $data10 != @21-08-16 16:09:00.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data12 != NULL then + return -1 +endi +if $data20 != @21-08-16 16:06:00.000@ then + return -1 +endi +if $data21 != NULL then + return -1 +endi +if $data22 != NULL then + return -1 +endi +if $data30 != @21-08-16 16:03:00.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data32 != NULL then + return -1 +endi +if $data40 != @21-08-16 16:00:00.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi +if $data42 != NULL then + return -1 +endi + +sql select interp(ip_value,ip_quality) from st_analogdef where name='TD_A01009' and ts >='2021-08-16 16:00:00.000' and ts <='2021-08-16 16:13:50.000' every(3m) fill(next) order by ts desc; +if $rows != 5 then + return -1 +endi +if $data00 != @21-08-16 16:12:00.000@ then + return -1 +endi +if $data01 != 5.00000 then + return -1 +endi +if $data02 != 6 then + return -1 +endi +if $data10 != @21-08-16 16:09:00.000@ then + return -1 +endi +if $data11 != NULL then + return -1 +endi +if $data12 != NULL then + return -1 +endi +if $data20 != @21-08-16 16:06:00.000@ then + return -1 +endi +if $data21 != NULL then + return -1 +endi +if $data22 != NULL then + return -1 +endi +if $data30 != @21-08-16 16:03:00.000@ then + return -1 +endi +if $data31 != NULL then + return -1 +endi +if $data32 != NULL then + return -1 +endi +if $data40 != @21-08-16 16:00:00.000@ then + return -1 +endi +if $data41 != NULL then + return -1 +endi +if $data42 != NULL then + return -1 +endi + +#system sh/exec.sh -n dnode1 -s stop -x SIGINT