提交 c1666e7e 编写于 作者: G Ganlin Zhao

feat(query): add sample function

上级 18ac565a
...@@ -848,7 +848,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = { ...@@ -848,7 +848,7 @@ const SBuiltinFuncDefinition funcMgtBuiltins[] = {
.getEnvFunc = getSampleFuncEnv, .getEnvFunc = getSampleFuncEnv,
.initFunc = sampleFunctionSetup, .initFunc = sampleFunctionSetup,
.processFunc = sampleFunction, .processFunc = sampleFunction,
.finalizeFunc = sampleFinalize .finalizeFunc = NULL
}, },
{ {
.name = "abs", .name = "abs",
......
...@@ -3124,19 +3124,19 @@ int32_t sampleFunction(SqlFunctionCtx* pCtx) { ...@@ -3124,19 +3124,19 @@ int32_t sampleFunction(SqlFunctionCtx* pCtx) {
return pInfo->numSampled; return pInfo->numSampled;
} }
int32_t sampleFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) { //int32_t sampleFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx); // SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
SSampleInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx)); // SSampleInfo* pInfo = GET_ROWCELL_INTERBUF(GET_RES_INFO(pCtx));
int32_t slotId = pCtx->pExpr->base.resSchema.slotId; // int32_t slotId = pCtx->pExpr->base.resSchema.slotId;
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId); // SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
//
//int32_t currentRow = pBlock->info.rows; // //int32_t currentRow = pBlock->info.rows;
pResInfo->numOfRes = pInfo->numSampled; // pResInfo->numOfRes = pInfo->numSampled;
//
for (int32_t i = 0; i < pInfo->numSampled; ++i) { // for (int32_t i = 0; i < pInfo->numSampled; ++i) {
colDataAppend(pCol, i, pInfo->data + i * pInfo->colBytes, false); // colDataAppend(pCol, i, pInfo->data + i * pInfo->colBytes, false);
//TODO: handle ts output // //TODO: handle ts output
} // }
//
return pResInfo->numOfRes; // return pResInfo->numOfRes;
} //}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册