fix: interp crash

This commit is contained in:
xsren 2024-07-22 00:06:47 +08:00
parent 2f0768e12d
commit ebe0074da4
10 changed files with 294 additions and 7 deletions

View File

@ -138,6 +138,7 @@ typedef enum EFunctionType {
FUNCTION_TYPE_CACHE_LAST_ROW,
FUNCTION_TYPE_CACHE_LAST,
FUNCTION_TYPE_TABLE_COUNT,
FUNCTION_TYPE_SELECT_TAG,
// distributed splitting functions
FUNCTION_TYPE_APERCENTILE_PARTIAL = 4000,
@ -256,6 +257,7 @@ bool fmIsConstantResFunc(SFunctionNode* pFunc);
bool fmIsSkipScanCheckFunc(int32_t funcId);
bool fmIsPrimaryKeyFunc(int32_t funcId);
bool fmIsProcessByRowFunc(int32_t funcId);
bool fmIsSelectTagFunc(int32_t funcId);
void getLastCacheDataType(SDataType* pType, int32_t pkBytes);
SFunctionNode* createFunction(const char* pName, SNodeList* pParameterList);

View File

@ -603,7 +603,8 @@ void copyResultrowToDataBlock(SExprInfo* pExprInfo, int32_t numOfExprs, SResultR
pCtx[j].resultInfo = getResultEntryInfo(pRow, j, rowEntryOffset);
if (pCtx[j].fpSet.finalize) {
if (strcmp(pCtx[j].pExpr->pExpr->_function.functionName, "_group_key") == 0) {
if (strcmp(pCtx[j].pExpr->pExpr->_function.functionName, "_group_key") == 0 ||
strcmp(pCtx[j].pExpr->pExpr->_function.functionName, "_select_tag") == 0) {
// for groupkey along with functions that output multiple lines(e.g. Histogram)
// need to match groupkey result for each output row of that function.
if (pCtx[j].resultInfo->numOfRes != 0) {

View File

@ -233,6 +233,11 @@ static bool isGroupKeyFunc(SExprInfo* pExprInfo) {
return (functionType == FUNCTION_TYPE_GROUP_KEY);
}
static bool isSelectTagFunc(SExprInfo* pExprInfo) {
int32_t functionType = pExprInfo->pExpr->_function.functionType;
return (functionType == FUNCTION_TYPE_SELECT_TAG);
}
static bool getIgoreNullRes(SExprSupp* pExprSup) {
for (int32_t i = 0; i < pExprSup->numOfExprs; ++i) {
SExprInfo* pExprInfo = &pExprSup->pExprInfo[i];
@ -296,7 +301,7 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
colDataSetVal(pDst, pResBlock->info.rows, (char*)&isFilled, false);
continue;
} else if (!isInterpFunc(pExprInfo)) {
if (isGroupKeyFunc(pExprInfo)) {
if (isGroupKeyFunc(pExprInfo) || isSelectTagFunc(pExprInfo)) {
if (pSrcBlock != NULL) {
int32_t srcSlot = pExprInfo->base.pParam[0].pCol->slotId;
SColumnInfoData* pSrc = taosArrayGet(pSrcBlock->pDataBlock, srcSlot);
@ -308,7 +313,7 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
char* v = colDataGetData(pSrc, index);
colDataSetVal(pDst, pResBlock->info.rows, v, false);
} else {
} else if(!isSelectTagFunc(pExprInfo)){
// use stored group key
SGroupKeys* pkey = pSliceInfo->pPrevGroupKey;
if (pkey->isNull == false) {
@ -316,6 +321,14 @@ static bool genInterpolationResult(STimeSliceOperatorInfo* pSliceInfo, SExprSupp
} else {
colDataSetNULL(pDst, rows);
}
} else {
int32_t srcSlot = pExprInfo->base.pParam[0].pCol->slotId;
SGroupKeys* pkey = taosArrayGet(pSliceInfo->pPrevRow, srcSlot);
if (pkey->isNull == false) {
colDataSetVal(pDst, rows, pkey->pData, false);
} else {
colDataSetNULL(pDst, rows);
}
}
}
continue;

View File

@ -254,6 +254,7 @@ bool getGroupKeyFuncEnv(SFunctionNode* pFunc, SFuncExecEnv* pEnv);
int32_t groupKeyFunction(SqlFunctionCtx* pCtx);
int32_t groupKeyFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock);
int32_t groupKeyCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx);
int32_t selectValueFunciton(SqlFunctionCtx* pCtx);
#ifdef __cplusplus
}

View File

@ -4108,6 +4108,16 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.sprocessFunc = md5Function,
.finalizeFunc = NULL
},
{
.name = "_select_tag",
.type = FUNCTION_TYPE_SELECT_TAG,
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_SELECT_FUNC | FUNC_MGT_KEEP_ORDER_FUNC,
.translateFunc = translateGroupKey,
.getEnvFunc = getGroupKeyFuncEnv,
.initFunc = functionSetup,
.processFunc = groupKeyFunction,
.finalizeFunc = groupKeyFinalize,
},
};
// clang-format on

View File

@ -6650,6 +6650,41 @@ _group_key_over:
return TSDB_CODE_SUCCESS;
}
int32_t selectValueFunciton(SqlFunctionCtx* pCtx) {
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
SGroupKeyInfo* pInfo = GET_ROWCELL_INTERBUF(pResInfo);
SInputColumnInfoData* pInput = &pCtx->input;
SColumnInfoData* pInputCol = pInput->pData[0];
int32_t startIndex = pInput->startRowIndex;
// escape rest of data blocks to avoid first entry to be overwritten.
if (pInfo->hasResult) {
goto _group_key_over;
}
if (pInputCol->pData == NULL || colDataIsNull_s(pInputCol, startIndex)) {
pInfo->isNull = true;
pInfo->hasResult = true;
goto _group_key_over;
}
char* data = colDataGetData(pInputCol, startIndex);
if (IS_VAR_DATA_TYPE(pInputCol->info.type)) {
memcpy(pInfo->data, data,
(pInputCol->info.type == TSDB_DATA_TYPE_JSON) ? getJsonValueLen(data) : varDataTLen(data));
} else {
memcpy(pInfo->data, data, pInputCol->info.bytes);
}
pInfo->hasResult = true;
_group_key_over:
SET_VAL(pResInfo, 1, 1);
return TSDB_CODE_SUCCESS;
}
int32_t groupKeyFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
int32_t slotId = pCtx->pExpr->base.resSchema.slotId;
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);

View File

@ -268,6 +268,13 @@ bool fmIsGroupKeyFunc(int32_t funcId) {
return FUNCTION_TYPE_GROUP_KEY == funcMgtBuiltins[funcId].type;
}
bool fmIsSelectTagFunc(int32_t funcId) {
if (funcId < 0 || funcId >= funcMgtBuiltinsNum) {
return false;
}
return FUNCTION_TYPE_SELECT_TAG == funcMgtBuiltins[funcId].type;
}
bool fmIsBlockDistFunc(int32_t funcId) {
if (funcId < 0 || funcId >= funcMgtBuiltinsNum) {
return false;

View File

@ -3162,6 +3162,25 @@ static EDealRes rewriteExprToGroupKeyFunc(STranslateContext* pCxt, SNode** pNode
return (TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR);
}
static EDealRes rewriteExprToSelectTagFunc(STranslateContext* pCxt, SNode** pNode) {
SFunctionNode* pFunc = (SFunctionNode*)nodesMakeNode(QUERY_NODE_FUNCTION);
if (NULL == pFunc) {
pCxt->errCode = TSDB_CODE_OUT_OF_MEMORY;
return DEAL_RES_ERROR;
}
strcpy(pFunc->functionName, "_select_tag");
strcpy(pFunc->node.aliasName, ((SExprNode*)*pNode)->aliasName);
strcpy(pFunc->node.userAlias, ((SExprNode*)*pNode)->userAlias);
pCxt->errCode = nodesListMakeAppend(&pFunc->pParameterList, *pNode);
if (TSDB_CODE_SUCCESS == pCxt->errCode) {
*pNode = (SNode*)pFunc;
pCxt->errCode = fmGetFuncInfo(pFunc, pCxt->msgBuf.buf, pCxt->msgBuf.len);
}
return (TSDB_CODE_SUCCESS == pCxt->errCode ? DEAL_RES_IGNORE_CHILD : DEAL_RES_ERROR);
}
static bool isWindowJoinProbeTablePrimCol(SSelectStmt* pSelect, SNode* pNode) {
if (QUERY_NODE_COLUMN != nodeType(pNode)) {
return false;
@ -3494,10 +3513,13 @@ static EDealRes doCheckAggColCoexist(SNode** pNode, void* pContext) {
}
}
if (partionByTbname &&
((QUERY_NODE_COLUMN == nodeType(*pNode) && ((SColumnNode*)*pNode)->colType == COLUMN_TYPE_TAG) ||
(QUERY_NODE_FUNCTION == nodeType(*pNode) && FUNCTION_TYPE_TBNAME == ((SFunctionNode*)*pNode)->funcType))) {
(QUERY_NODE_FUNCTION == nodeType(*pNode) && FUNCTION_TYPE_TBNAME == ((SFunctionNode*)*pNode)->funcType)) {
return rewriteExprToGroupKeyFunc(pCxt->pTranslateCxt, pNode);
}
if (partionByTbname &&
((QUERY_NODE_COLUMN == nodeType(*pNode) && ((SColumnNode*)*pNode)->colType == COLUMN_TYPE_TAG))) {
return rewriteExprToSelectTagFunc(pCxt->pTranslateCxt, pNode);
}
if (isScanPseudoColumnFunc(*pNode) || QUERY_NODE_COLUMN == nodeType(*pNode)) {
pCxt->existCol = true;
}
@ -4951,7 +4973,8 @@ static int32_t translateOrderBy(STranslateContext* pCxt, SSelectStmt* pSelect) {
}
static EDealRes needFillImpl(SNode* pNode, void* pContext) {
if ((isAggFunc(pNode) || isInterpFunc(pNode)) && FUNCTION_TYPE_GROUP_KEY != ((SFunctionNode*)pNode)->funcType) {
if ((isAggFunc(pNode) || isInterpFunc(pNode)) && FUNCTION_TYPE_GROUP_KEY != ((SFunctionNode*)pNode)->funcType
&& FUNCTION_TYPE_SELECT_TAG != ((SFunctionNode*)pNode)->funcType) {
*(bool*)pContext = true;
return DEAL_RES_END;
}

View File

@ -891,7 +891,7 @@ static int32_t createIndefRowsFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt
}
static bool isInterpFunc(int32_t funcId) {
return fmIsInterpFunc(funcId) || fmIsInterpPseudoColumnFunc(funcId) || fmIsGroupKeyFunc(funcId);
return fmIsInterpFunc(funcId) || fmIsInterpPseudoColumnFunc(funcId) || fmIsGroupKeyFunc(funcId) || fmIsSelectTagFunc(funcId);
}
static int32_t createInterpFuncLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect, SLogicNode** pLogicNode) {

View File

@ -38,6 +38,200 @@ class TDTestCase:
tdSql.query(f"select _irowts, interp(k),k from {dbname}.{tbname} partition by k range(now()-1h, now()) every(1m) fill(value, 2)")
tdSql.checkRows(0)
def ts5181(self):
tdSql.execute("create database db1 keep 36500")
tdSql.execute("use db1")
tdSql.execute("CREATE STABLE db1.`stb1` (`ts` TIMESTAMP ENCODE 'delta-i' COMPRESS 'lz4' LEVEL 'medium', `v1` INT ENCODE 'simple8b' COMPRESS 'lz4' LEVEL 'medium') TAGS (`t1` INT)")
tdSql.execute("insert into db1.ttt_10000 using db1.stb1 tags( 44400 ) values('2024-02-19 16:05:17.649', 22300 ); ")
tdSql.execute("insert into db1.ttt_10000 using db1.stb1 tags( 44400 ) values('2024-02-19 16:05:48.818', 22300 ); ")
tdSql.execute("insert into db1.ttt_10 using db1.stb1 tags( 40 ) values('2024-02-19 16:25:36.013', 20 ); ")
tdSql.execute("insert into db1.ttt_11 using db1.stb1 tags( 11 ) values('2024-02-19 16:39:50.385' , 20 ); ")
tdSql.execute("insert into db1.ttt_11 using db1.stb1 tags( 11 ) values('2024-02-19 16:43:51.742' , 20 ); ")
tdSql.execute("insert into db1.ttt_11 using db1.stb1 tags( 11 ) values('2024-02-20 08:35:13.518' , 20 ); ")
tdSql.execute("insert into db1.ttt_11 using db1.stb1 tags( 11 ) values('2024-02-20 08:58:42.255' , 20 ); ")
tdSql.execute("insert into db1.ttt_11 using db1.stb1 tags( 11 ) values('2024-02-21 09:57:49.477' , 20 ); ")
tdSql.execute("insert into db1.`ttt_2024-2-21` using db1.stb1 tags( 11 ) values('2024-02-21 09:58:21.882' , 20 ); ")
tdSql.execute("insert into db1.`ttt_2024-2-21` using db1.stb1 tags( 11 ) values('2024-02-26 16:08:31.675' , 20 ); ")
tdSql.execute("insert into db1.`ttt_2024-2-21` using db1.stb1 tags( 11 ) values('2024-02-26 16:11:43.445' , NULL ); ")
tdSql.execute("insert into db1.`ttt_2024-2-33` using db1.stb1 tags( 11 ) values('2024-02-26 16:12:30.276' , NULL ); ")
tdSql.execute("insert into db1.`ttt_2024-2-33` using db1.stb1 tags( 11 ) values('2024-02-26 16:25:07.188' , NULL ); ")
tdSql.execute("insert into db1.`ttt_2024-2-33` using db1.stb1 tags( 11 ) values('2024-02-26 16:25:07.653' , NULL ); ")
tdSql.execute("insert into db1.`ttt_2024-2-33` using db1.stb1 tags( 11 ) values('2024-02-26 16:25:07.879' , NULL ); ")
tdSql.execute("insert into db1.`ttt_2024-2-33` using db1.stb1 tags( 11 ) values('2024-02-26 16:25:08.083' , NULL ); ")
tdSql.execute("insert into db1.`ttt_2024-2-33` using db1.stb1 tags( 11 ) values('2024-02-26 16:25:08.273' , NULL ); ")
tdSql.execute("insert into db1.`ttt_2024-2-33` using db1.stb1 tags( 11 ) values('2024-02-26 16:25:08.429' , NULL ); ")
tdSql.execute("insert into db1.`ttt_2024-2-33` using db1.stb1 tags( 11 ) values('2024-02-26 16:25:08.599' , NULL ); ")
tdSql.execute("insert into db1.`ttt_2024-2-33` using db1.stb1 tags( 11 ) values('2024-02-26 16:25:08.775' , NULL ); ")
tdSql.execute("insert into db1.`ttt_2024-2-33` using db1.stb1 tags( 11 ) values('2024-02-26 16:25:08.940' , NULL ); ")
tdSql.execute("insert into db1.`ttt_2024-2-33` using db1.stb1 tags( 11 ) values('2024-02-26 16:25:09.110' , NULL ); ")
tdSql.execute("insert into db1.`ttt_2024-2-33` using db1.stb1 tags( 11 ) values('2024-02-26 16:25:09.254' , NULL ); ")
tdSql.execute("insert into db1.`ttt_2024-2-33` using db1.stb1 tags( 11 ) values('2024-02-26 16:25:09.409' , NULL ); ")
tdSql.execute("insert into db1.`ttt_2024-2-33` using db1.stb1 tags( 11 ) values('2024-02-26 16:25:34.750' , 12 ); ")
tdSql.execute("insert into db1.`ttt_2024-2-33` using db1.stb1 tags( 11 ) values('2024-02-26 16:25:49.820' , 12 ); ")
tdSql.execute("insert into db1.`ttt_2024-2-33` using db1.stb1 tags( 11 ) values('2024-02-26 16:25:59.551' , NULL ); ")
tdSql.execute("insert into db1.ttt_2 using db1.stb1 tags( 2 ) values('2024-02-19 15:26:39.644' , 2 ); ")
tdSql.execute("insert into db1.ttt_2 using db1.stb1 tags( 2 ) values('2024-02-19 15:26:40.433' , 2 ); ")
tdSql.execute("insert into db1.ttt_3 using db1.stb1 tags( 3 ) values('2024-02-19 15:27:22.613' , 1 ); ")
tdSql.execute("insert into db1.ttt_13 using db1.stb1 tags( 3 ) values('2024-02-19 15:27:39.719' , 1 ); ")
tdSql.execute("insert into db1.ttt_14 using db1.stb1 tags( 3 ) values('2024-02-19 15:28:36.235' , 222 ); ")
tdSql.execute("insert into db1.ttt_14 using db1.stb1 tags( 3 ) values('2024-02-19 15:28:59.310' , 222 ); ")
tdSql.execute("insert into db1.ttt_14 using db1.stb1 tags( 3 ) values('2024-02-19 15:29:18.897' , 222 ); ")
tdSql.execute("insert into db1.ttt_14 using db1.stb1 tags( 3 ) values('2024-02-19 15:50:24.682' , 223 ); ")
tdSql.execute("insert into db1.ttt_4 using db1.stb1 tags( 3 ) values('2024-02-19 15:31:19.945' , 222 ); ")
tdSql.execute("insert into db1.ttt_a using db1.stb1 tags( 3 ) values('2024-02-19 15:31:37.915' , 4 ); ")
tdSql.execute("insert into db1.ttt_axxxx using db1.stb1 tags( NULL ) values('2024-02-19 15:31:58.953' , 4 ); ")
tdSql.execute("insert into db1.ttt_axxx using db1.stb1 tags( 56 ) values('2024-02-19 15:32:22.323' , NULL ); ")
tdSql.execute("insert into db1.ttt_444 using db1.stb1 tags( 5633 ) values('2024-02-19 15:36:44.625' , 5444 ); ")
tdSql.execute("insert into db1.ttt_444 using db1.stb1 tags( 5633 ) values('2024-02-19 15:38:41.479' , 5444 ); ")
tdSql.execute("insert into db1.ttt_444 using db1.stb1 tags( 5633 ) values('2024-02-19 15:57:23.249' , 5444 ); ")
tdSql.execute("insert into db1.ttt_444 using db1.stb1 tags( 5633 ) values('2024-02-19 16:04:20.465' , 5444 ); ")
tdSql.execute("insert into db1.ttt_444 using db1.stb1 tags( 5633 ) values('2024-02-26 16:11:29.364' , 5444 ); ")
tdSql.execute("insert into db1.ttt_123 using db1.stb1 tags( 0 ) values('2024-02-19 15:44:52.136' , 223 ); ")
tdSql.execute("insert into db1.ttt_145 using db1.stb1 tags( 0 ) values('2024-02-19 15:50:28.580' , 223 ); ")
tdSql.execute("insert into db1.ttt_1465 using db1.stb1 tags( 0 ) values('2024-02-19 15:50:32.493' , 223 ); ")
tdSql.execute("insert into db1.ttt_1465 using db1.stb1 tags( 0 ) values('2024-02-19 15:57:36.866' , 223 ); ")
tdSql.execute("insert into db1.ttt_1465 using db1.stb1 tags( 0 ) values('2024-02-19 16:04:52.794' , 221113 ); ")
tdSql.execute("insert into db1.ttt_444 using db1.stb1 tags( 5633 ) values('2024-02-27 08:47:11.366' , 5444 ); ")
tdSql.execute("insert into db1.ttt_444 using db1.stb1 tags( 5633 ) values('2024-02-28 09:35:46.474' , 5444 ); ")
tdSql.query("select *,tbname from db1.stb1 ;")
tdSql.checkRows(51)
tdSql.query("select _irowts as ts,interp(v1),t1,tbname from db1.stb1 \
where ts>'2024-02-19T15:25:00+08:00' and ts<'2024-02-19T16:05:00+08:00' \
partition by tbname range('2024-02-19T15:30:00+08:00','2024-02-19T15:30:00+08:00') every(1m) fill(prev)")
tdSql.checkRows(4)
tdSql.query("select _irowts as ts,interp(v1),t1,tbname from db1.stb1 \
where ts>'2024-02-19T15:25:00+08:00' and ts<'2024-02-19T16:05:00+08:00' \
partition by tbname range('2024-02-19T15:30:00+08:00','2024-02-19T15:30:00+08:00') every(1m) fill(prev) order by tbname")
tdSql.checkData(0, 2, 3)
tdSql.checkData(1, 2, 3)
tdSql.checkData(2, 2, 2)
tdSql.checkData(3, 2, 3)
tdSql.checkData(0, 3, "ttt_13")
tdSql.checkData(1, 3, "ttt_14")
tdSql.checkData(2, 3, "ttt_2")
tdSql.checkData(3, 3, "ttt_3")
tdSql.query("select _irowts as ts,interp(v1),t1,tbname from db1.stb1 \
where ts>'2024-02-19T15:25:00+08:00' and ts<'2024-02-19T16:05:00+08:00' \
partition by tbname range('2024-02-19T15:30:00+08:00','2024-02-19T15:30:00+08:00') every(1m) \
fill(value, 0) order by tbname")
tdSql.checkRows(12)
tdSql.checkData(0, 2, 0)
tdSql.checkData(0, 3, "ttt_123")
tdSql.checkData(1, 2, 3)
tdSql.checkData(1, 3, "ttt_13")
tdSql.query("select _irowts as ts,interp(v1),tbname from db1.stb1 \
where ts>'2024-02-19T15:25:00+08:00' and ts<'2024-02-19T16:05:00+08:00' \
partition by tbname range('2024-02-19T15:30:00+08:00','2024-02-19T15:30:00+08:00') every(1m) \
fill(value, 0) order by tbname")
tdSql.checkRows(12)
tdSql.checkData(0, 2, "ttt_123")
tdSql.checkData(1, 2, "ttt_13")
tdSql.query("select _irowts as ts,interp(v1),t1,tbname from db1.stb1 \
where ts>'2024-02-19T15:25:00+08:00' and ts<'2024-02-19T16:05:00+08:00' \
partition by tbname range('2024-02-19T15:30:00+08:00','2024-02-19T15:30:00+08:00') every(1m) \
fill(NULL) order by tbname")
tdSql.checkRows(12)
tdSql.checkData(0, 2, 0)
tdSql.checkData(0, 3, "ttt_123")
tdSql.checkData(1, 2, 3)
tdSql.checkData(1, 3, "ttt_13")
tdSql.query("select _irowts as ts,interp(v1),t1 from db1.stb1 \
where ts>'2024-02-19T15:25:00+08:00' and ts<'2024-02-19T16:05:00+08:00' \
partition by tbname range('2024-02-19T15:30:00+08:00','2024-02-19T15:30:00+08:00') every(1m) \
fill(NULL) order by tbname")
tdSql.checkRows(12)
tdSql.checkData(0, 2, 0)
tdSql.checkData(1, 2, 3)
tdSql.query("select _irowts as ts,interp(v1), tbname from db1.stb1 \
where ts>'2024-02-19T15:25:00+08:00' and ts<'2024-02-19T16:05:00+08:00' \
partition by tbname range('2024-02-19T15:30:00+08:00','2024-02-19T15:30:00+08:00') every(1m) \
fill(NULL) order by tbname")
tdSql.checkRows(12)
tdSql.checkData(0, 2, "ttt_123")
tdSql.checkData(1, 2, "ttt_13")
tdSql.query("select _irowts as ts,interp(v1),t1,tbname from db1.stb1 \
where ts>'2024-02-19T15:25:00+08:00' and ts<'2024-02-19T16:05:00+08:00' \
partition by tbname range('2024-02-19T15:30:00+08:00','2024-02-19T15:30:00+08:00') every(1m) \
fill(NULL) order by tbname")
tdSql.checkRows(12)
tdSql.checkData(0, 2, 0)
tdSql.checkData(0, 3, "ttt_123")
tdSql.checkData(1, 2, 3)
tdSql.checkData(1, 3, "ttt_13")
tdSql.query("select _irowts as ts,interp(v1),t1,tbname from db1.stb1 \
where ts>'2024-02-19T15:25:00+08:00' and ts<'2024-02-19T16:05:00+08:00' \
partition by tbname range('2024-02-19T15:30:00+08:00','2024-02-19T15:30:00+08:00') every(1m) \
fill(LINEAR) order by tbname")
tdSql.checkRows(1)
tdSql.checkData(0, 2, 3)
tdSql.checkData(0, 3, "ttt_14")
tdSql.query("select _irowts as ts,interp(v1), tbname from db1.stb1 \
where ts>'2024-02-19T15:25:00+08:00' and ts<'2024-02-19T16:05:00+08:00' \
partition by tbname range('2024-02-19T15:30:00+08:00','2024-02-19T15:30:00+08:00') every(1m) \
fill(LINEAR) order by tbname")
tdSql.checkRows(1)
tdSql.checkData(0, 2, "ttt_14")
tdSql.query("select _irowts as ts,interp(v1),t1 from db1.stb1 \
where ts>'2024-02-19T15:25:00+08:00' and ts<'2024-02-19T16:05:00+08:00' \
partition by tbname range('2024-02-19T15:30:00+08:00','2024-02-19T15:30:00+08:00') every(1m) \
fill(LINEAR) order by tbname")
tdSql.checkRows(1)
tdSql.checkData(0, 2, 3)
tdSql.query("select _irowts as ts,interp(v1),t1, tbname from db1.stb1 \
where ts>'2024-02-19T15:25:00+08:00' and ts<'2024-02-19T16:05:00+08:00' \
partition by tbname range('2024-02-19T15:30:00+08:00','2024-02-19T15:30:00+08:00') every(1m) \
fill(NEXT) order by tbname")
tdSql.checkRows(9)
tdSql.checkData(0, 2, 0)
tdSql.checkData(0, 3, "ttt_123")
tdSql.query("select _irowts as ts,interp(v1),t1 from db1.stb1 \
where ts>'2024-02-19T15:25:00+08:00' and ts<'2024-02-19T16:05:00+08:00' \
partition by tbname range('2024-02-19T15:30:00+08:00','2024-02-19T15:30:00+08:00') every(1m) \
fill(NEXT) order by tbname")
tdSql.checkRows(9)
tdSql.checkData(0, 2, 0)
tdSql.query("select _irowts as ts,interp(v1),tbname from db1.stb1 \
where ts>'2024-02-19T15:25:00+08:00' and ts<'2024-02-19T16:05:00+08:00' \
partition by tbname range('2024-02-19T15:30:00+08:00','2024-02-19T15:30:00+08:00') every(1m) \
fill(NEXT) order by tbname")
tdSql.checkRows(9)
tdSql.checkData(0, 2, "ttt_123")
tdSql.query("select _irowts as ts,interp(v1),t1, tbname from db1.stb1 \
where ts>'2024-02-19T15:25:00+08:00' and ts<'2024-02-19T16:05:00+08:00' \
partition by tbname range('2024-02-19T15:30:00+08:00','2024-02-19T15:30:00+08:00') every(1m) \
fill(NULL_F) order by tbname")
tdSql.checkRows(12)
tdSql.checkData(0, 2, 0)
tdSql.checkData(0, 3, "ttt_123")
tdSql.query("select _irowts as ts,interp(v1),t1, tbname from db1.stb1 \
where ts>'2024-02-19T15:25:00+08:00' and ts<'2024-02-19T16:05:00+08:00' \
partition by tbname range('2024-02-19T15:30:00+08:00','2024-02-19T15:30:00+08:00') every(1m) \
fill(VALUE_F, 5) order by tbname")
tdSql.checkRows(12)
tdSql.checkData(0, 1, 5)
tdSql.checkData(0, 2, 0)
tdSql.checkData(0, 3, "ttt_123")
def run(self):
dbname = "db"
@ -5683,6 +5877,7 @@ class TDTestCase:
tdSql.checkData(0, 1, None)
self.interp_on_empty_table()
self.ts5181()
def stop(self):