fix(query): set correct fill output object.
This commit is contained in:
parent
a911feeab7
commit
707f0a837a
|
@ -34,7 +34,6 @@ typedef enum EFunctionType {
|
||||||
FUNCTION_TYPE_ELAPSED,
|
FUNCTION_TYPE_ELAPSED,
|
||||||
FUNCTION_TYPE_IRATE,
|
FUNCTION_TYPE_IRATE,
|
||||||
FUNCTION_TYPE_LAST_ROW,
|
FUNCTION_TYPE_LAST_ROW,
|
||||||
FUNCTION_TYPE_LAST_ROWT, // TODO: removed
|
|
||||||
FUNCTION_TYPE_MAX,
|
FUNCTION_TYPE_MAX,
|
||||||
FUNCTION_TYPE_MIN,
|
FUNCTION_TYPE_MIN,
|
||||||
FUNCTION_TYPE_MODE,
|
FUNCTION_TYPE_MODE,
|
||||||
|
|
|
@ -3127,14 +3127,11 @@ int32_t tsdbGetFileBlocksDistInfo(STsdbReader* pReader, STableBlockDistInfo* pTa
|
||||||
}
|
}
|
||||||
|
|
||||||
pTableBlockInfo->numOfBlocks += pBlockIter->numOfBlocks;
|
pTableBlockInfo->numOfBlocks += pBlockIter->numOfBlocks;
|
||||||
|
hasNext = (pBlockIter->numOfBlocks > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// tsdbDebug("%p %d blocks found in file for %d table(s), fid:%d, %s", pReader, numOfBlocks, numOfTables,
|
||||||
hasNext = blockIteratorNext(&pStatus->blockIter);
|
// pReader->pFileGroup->fid, pReader->idStr);
|
||||||
*/
|
|
||||||
|
|
||||||
// tsdbDebug("%p %d blocks found in file for %d table(s), fid:%d, %s", pReader, numOfBlocks, numOfTables,
|
|
||||||
// pReader->pFileGroup->fid, pReader->idStr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
|
|
|
@ -3409,8 +3409,8 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
|
||||||
|
|
||||||
blockDataEnsureCapacity(pResBlock, pOperator->resultInfo.capacity);
|
blockDataEnsureCapacity(pResBlock, pOperator->resultInfo.capacity);
|
||||||
|
|
||||||
int32_t numOfResultRows = pOperator->resultInfo.capacity - pBlock->info.rows;
|
int32_t numOfResultRows = pOperator->resultInfo.capacity - pResBlock->info.rows;
|
||||||
taosFillResultDataBlock(pInfo->pFillInfo, pBlock, numOfResultRows);
|
taosFillResultDataBlock(pInfo->pFillInfo, pResBlock, numOfResultRows);
|
||||||
|
|
||||||
// current group has no more result to return
|
// current group has no more result to return
|
||||||
if (pResBlock->info.rows > 0) {
|
if (pResBlock->info.rows > 0) {
|
||||||
|
@ -4423,6 +4423,8 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
|
||||||
cond.twindows = (STimeWindow){.skey = INT64_MIN, .ekey = INT64_MAX};
|
cond.twindows = (STimeWindow){.skey = INT64_MIN, .ekey = INT64_MAX};
|
||||||
cond.suid = pBlockNode->suid;
|
cond.suid = pBlockNode->suid;
|
||||||
cond.type = BLOCK_LOAD_OFFSET_ORDER;
|
cond.type = BLOCK_LOAD_OFFSET_ORDER;
|
||||||
|
cond.startVersion = -1;
|
||||||
|
cond.endVersion = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
STsdbReader* pReader = NULL;
|
STsdbReader* pReader = NULL;
|
||||||
|
|
|
@ -106,7 +106,7 @@ bool irateFuncSetup(SqlFunctionCtx *pCtx, SResultRowEntryInfo* pResInfo);
|
||||||
int32_t irateFunction(SqlFunctionCtx *pCtx);
|
int32_t irateFunction(SqlFunctionCtx *pCtx);
|
||||||
int32_t irateFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock);
|
int32_t irateFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock);
|
||||||
|
|
||||||
int32_t lastrowFunction(SqlFunctionCtx* pCtx);
|
int32_t cacheLastRowFunction(SqlFunctionCtx* pCtx);
|
||||||
|
|
||||||
bool getFirstLastFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv);
|
bool getFirstLastFuncEnv(struct SFunctionNode* pFunc, SFuncExecEnv* pEnv);
|
||||||
int32_t firstFunction(SqlFunctionCtx *pCtx);
|
int32_t firstFunction(SqlFunctionCtx *pCtx);
|
||||||
|
@ -120,7 +120,6 @@ int32_t lastCombine(SqlFunctionCtx* pDestCtx, SqlFunctionCtx* pSourceCtx);
|
||||||
int32_t getFirstLastInfoSize(int32_t resBytes);
|
int32_t getFirstLastInfoSize(int32_t resBytes);
|
||||||
|
|
||||||
int32_t lastRowFunction(SqlFunctionCtx *pCtx);
|
int32_t lastRowFunction(SqlFunctionCtx *pCtx);
|
||||||
int32_t lastRowFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock);
|
|
||||||
|
|
||||||
bool getTopBotFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv);
|
bool getTopBotFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv);
|
||||||
bool getTopBotMergeFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv);
|
bool getTopBotMergeFuncEnv(SFunctionNode* UNUSED_PARAM(pFunc), SFuncExecEnv* pEnv);
|
||||||
|
|
|
@ -1370,11 +1370,6 @@ static int32_t translateTail(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t translateLastRow(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
|
||||||
// todo
|
|
||||||
return TSDB_CODE_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int32_t translateDerivative(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
static int32_t translateDerivative(SFunctionNode* pFunc, char* pErrBuf, int32_t len) {
|
||||||
if (3 != LIST_LENGTH(pFunc->pParameterList)) {
|
if (3 != LIST_LENGTH(pFunc->pParameterList)) {
|
||||||
return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName);
|
return invaildFuncParaNumErrMsg(pErrBuf, len, pFunc->functionName);
|
||||||
|
@ -2221,7 +2216,17 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
|
||||||
.translateFunc = translateFirstLast,
|
.translateFunc = translateFirstLast,
|
||||||
.getEnvFunc = getFirstLastFuncEnv,
|
.getEnvFunc = getFirstLastFuncEnv,
|
||||||
.initFunc = functionSetup,
|
.initFunc = functionSetup,
|
||||||
.processFunc = lastrowFunction,
|
.processFunc = lastRowFunction,
|
||||||
|
.finalizeFunc = firstLastFinalize
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.name = "_cache_last_row",
|
||||||
|
.type = FUNCTION_TYPE_CACHE_LAST_ROW,
|
||||||
|
.classification = FUNC_MGT_AGG_FUNC | FUNC_MGT_MULTI_RES_FUNC | FUNC_MGT_TIMELINE_FUNC | FUNC_MGT_IMPLICIT_TS_FUNC,
|
||||||
|
.translateFunc = translateFirstLast,
|
||||||
|
.getEnvFunc = getFirstLastFuncEnv,
|
||||||
|
.initFunc = functionSetup,
|
||||||
|
.processFunc = cacheLastRowFunction,
|
||||||
.finalizeFunc = firstLastFinalize
|
.finalizeFunc = firstLastFinalize
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -5993,7 +5993,7 @@ int32_t interpFunction(SqlFunctionCtx* pCtx) {
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t lastrowFunction(SqlFunctionCtx* pCtx) {
|
int32_t cacheLastRowFunction(SqlFunctionCtx* pCtx) {
|
||||||
int32_t numOfElems = 0;
|
int32_t numOfElems = 0;
|
||||||
|
|
||||||
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
|
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
|
||||||
|
|
|
@ -103,7 +103,8 @@ $ms2 = 1601481600000 - $cc
|
||||||
|
|
||||||
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms and ts > $ms2 interval(1m) fill(value,0)
|
sql select count(tbcol), avg(tbcol), max(tbcol), min(tbcol), count(tbcol) from $tb where ts <= $ms and ts > $ms2 interval(1m) fill(value,0)
|
||||||
print ===> $rows
|
print ===> $rows
|
||||||
if $rows < 30 then
|
if $rows < 30 then
|
||||||
|
print expect greater than 30, actual: $rows
|
||||||
return -1
|
return -1
|
||||||
endi
|
endi
|
||||||
if $rows > 50 then
|
if $rows > 50 then
|
||||||
|
|
Loading…
Reference in New Issue