fix bug
This commit is contained in:
parent
bf077578e8
commit
ec041953a3
|
@ -2488,7 +2488,7 @@ static void buildTopBotStruct(STopBotInfo *pTopBotInfo, SQLFunctionCtx *pCtx) {
|
||||||
|
|
||||||
static bool top_bottom_function_setup(SQLFunctionCtx *pCtx) {
|
static bool top_bottom_function_setup(SQLFunctionCtx *pCtx) {
|
||||||
if (!function_setup(pCtx)) {
|
if (!function_setup(pCtx)) {
|
||||||
//return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
STopBotInfo *pInfo = getTopBotOutputInfo(pCtx);
|
STopBotInfo *pInfo = getTopBotOutputInfo(pCtx);
|
||||||
|
@ -2574,6 +2574,10 @@ static void bottom_function(SQLFunctionCtx *pCtx) {
|
||||||
|
|
||||||
STopBotInfo *pRes = getTopBotOutputInfo(pCtx);
|
STopBotInfo *pRes = getTopBotOutputInfo(pCtx);
|
||||||
|
|
||||||
|
if (pRes->res[0] != ((char *)pRes + sizeof(STopBotInfo) + POINTER_BYTES * pCtx->param[0].i64)) {
|
||||||
|
buildTopBotStruct(pRes, pCtx);
|
||||||
|
}
|
||||||
|
|
||||||
for (int32_t i = 0; i < pCtx->size; ++i) {
|
for (int32_t i = 0; i < pCtx->size; ++i) {
|
||||||
char *data = GET_INPUT_DATA(pCtx, i);
|
char *data = GET_INPUT_DATA(pCtx, i);
|
||||||
TSKEY ts = GET_TS_DATA(pCtx, i);
|
TSKEY ts = GET_TS_DATA(pCtx, i);
|
||||||
|
@ -2608,6 +2612,11 @@ static void bottom_function_f(SQLFunctionCtx *pCtx, int32_t index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
STopBotInfo *pRes = getTopBotOutputInfo(pCtx);
|
STopBotInfo *pRes = getTopBotOutputInfo(pCtx);
|
||||||
|
|
||||||
|
if (pRes->res[0] != ((char *)pRes + sizeof(STopBotInfo) + POINTER_BYTES * pCtx->param[0].i64)) {
|
||||||
|
buildTopBotStruct(pRes, pCtx);
|
||||||
|
}
|
||||||
|
|
||||||
SET_VAL(pCtx, 1, 1);
|
SET_VAL(pCtx, 1, 1);
|
||||||
do_bottom_function_add(pRes, (int32_t)pCtx->param[0].i64, pData, ts, pCtx->inputType, &pCtx->tagInfo, NULL, 0);
|
do_bottom_function_add(pRes, (int32_t)pCtx->param[0].i64, pData, ts, pCtx->inputType, &pCtx->tagInfo, NULL, 0);
|
||||||
|
|
||||||
|
|
|
@ -3786,7 +3786,7 @@ void setResultRowOutputBufInitCtx(SQueryRuntimeEnv *pRuntimeEnv, SResultRow *pRe
|
||||||
pCtx->ptsOutputBuf = pRuntimeEnv->pCtx[0].pOutput;
|
pCtx->ptsOutputBuf = pRuntimeEnv->pCtx[0].pOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pCtx->resultInfo->initialized || functionId == TSDB_FUNC_TOP || functionId == TSDB_FUNC_BOTTOM) {
|
if (!pCtx->resultInfo->initialized) {
|
||||||
aAggs[functionId].init(pCtx);
|
aAggs[functionId].init(pCtx);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue