提交 18ac565a 编写于 作者: G Ganlin Zhao

feat(query): add sample function

上级 315a8752
......@@ -3104,7 +3104,6 @@ int32_t sampleFunction(SqlFunctionCtx* pCtx) {
SColumnInfoData* pTsOutput = pCtx->pTsOutput;
SColumnInfoData* pOutput = (SColumnInfoData*)pCtx->pOutput;
int32_t type = pInputCol->info.type;
int32_t startOffset = pCtx->offset;
for (int32_t i = pInput->startRowIndex; i < pInput->numOfRows + pInput->startRowIndex; i += 1) {
if (colDataIsNull_f(pInputCol->nullbitmap, i)) {
......@@ -3116,6 +3115,12 @@ int32_t sampleFunction(SqlFunctionCtx* pCtx) {
doReservoirSample(pInfo, data, tsList[i], i);
}
for (int32_t i = 0; i < pInfo->numSampled; ++i) {
int32_t pos = startOffset + i;
colDataAppend(pOutput, pos, pInfo->data + i * pInfo->colBytes, false);
//TODO: handle ts output
}
return pInfo->numSampled;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册