提交 410ba6f0 编写于 作者: S shenglian zhou

fix: apply function offset/forward step error when session + order by ts desc

上级 ba91ae0d
......@@ -1744,6 +1744,9 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSWindowOperatorInf
SQueryRuntimeEnv* pRuntimeEnv = pOperator->pRuntimeEnv;
STableQueryInfo* item = pRuntimeEnv->current;
SQueryAttr *pQueryAttr = pRuntimeEnv->pQueryAttr;
bool ascQuery = QUERY_IS_ASC_QUERY(pQueryAttr);
// primary timestamp column
SColumnInfoData* pColInfoData = taosArrayGet(pSDataBlock->pDataBlock, 0);
......@@ -1783,7 +1786,9 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSWindowOperatorInf
longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_APP_ERROR);
}
doApplyFunctions(pRuntimeEnv, pBInfo->pCtx, &pInfo->curWindow, pInfo->start, pInfo->numOfRows, tsList,
int32_t forwardStep = pInfo->numOfRows;
int32_t offset = (ascQuery) ? pInfo->start : pInfo->start + forwardStep - 1;
doApplyFunctions(pRuntimeEnv, pBInfo->pCtx, &pInfo->curWindow, offset, forwardStep, tsList,
pSDataBlock->info.rows, pOperator->numOfOutput);
pInfo->curWindow.skey = tsList[j];
......@@ -1803,7 +1808,9 @@ static void doSessionWindowAggImpl(SOperatorInfo* pOperator, SSWindowOperatorInf
longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_APP_ERROR);
}
doApplyFunctions(pRuntimeEnv, pBInfo->pCtx, &pInfo->curWindow, pInfo->start, pInfo->numOfRows, tsList,
int32_t forwardStep = pInfo->numOfRows;
int32_t offset = (ascQuery) ? pInfo->start : pInfo->start + forwardStep - 1;
doApplyFunctions(pRuntimeEnv, pBInfo->pCtx, &pInfo->curWindow, offset, forwardStep, tsList,
pSDataBlock->info.rows, pOperator->numOfOutput);
}
......
......@@ -618,6 +618,13 @@ SArray* createExecOperatorPlan(SQueryAttr* pQueryAttr) {
op = OP_Project;
taosArrayPush(plan, &op);
}
int32_t orderColId = pQueryAttr->order.orderColId;
if (orderColId != INT32_MIN) {
op = OP_Order;
taosArrayPush(plan, &op);
}
} else if (pQueryAttr->stateWindow) {
op = OP_StateWindow;
taosArrayPush(plan, &op);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册