提交 392e2572 编写于 作者: A Alex Duan

fix(query): fixed group by col_proj_function des error on client. [TS-1605]

上级 034ee479
......@@ -3347,6 +3347,12 @@ static void col_project_function(SQLFunctionCtx *pCtx) {
memcpy(pCtx->pOutput, pData, (size_t) numOfRows * pCtx->inputBytes);
} else {
// DESC
if (pCtx->param[0].i64 == 1) {
// only output one row, copy first row to output
memcpy(pCtx->pOutput, pData, (size_t)pCtx->inputBytes);
return ;
}
for(int32_t i = 0; i < pCtx->size; ++i) {
char* dst = pCtx->pOutput + (pCtx->size - 1 - i) * pCtx->inputBytes;
char* src = pData + i * pCtx->inputBytes;
......
......@@ -944,8 +944,6 @@ void doInvokeUdf(SUdfInfo* pUdfInfo, SQLFunctionCtx *pCtx, int32_t idx, int32_t
static void doApplyFunctions(SQueryRuntimeEnv* pRuntimeEnv, SQLFunctionCtx* pCtx, STimeWindow* pWin, int32_t offset,
int32_t forwardStep, TSKEY* tsCol, int32_t numOfTotal, int32_t numOfOutput) {
SQueryAttr *pQueryAttr = pRuntimeEnv->pQueryAttr;
for (int32_t k = 0; k < numOfOutput; ++k) {
bool hasAggregates = pCtx[k].preAggVals.isSet;
......@@ -956,13 +954,13 @@ static void doApplyFunctions(SQueryRuntimeEnv* pRuntimeEnv, SQLFunctionCtx* pCtx
// keep it temporarialy
char* start = pCtx[k].pInput;
int32_t pos = (QUERY_IS_ASC_QUERY(pQueryAttr)) ? offset : offset - (forwardStep - 1);
// deal order by in aAggs.xFunction, not here
if (pCtx[k].pInput != NULL) {
pCtx[k].pInput = (char *)pCtx[k].pInput + pos * pCtx[k].inputBytes;
pCtx[k].pInput = (char *)pCtx[k].pInput + offset * pCtx[k].inputBytes;
}
if (tsCol != NULL) {
pCtx[k].ptsList = &tsCol[pos];
pCtx[k].ptsList = &tsCol[offset];
}
// not a whole block involved in query processing, statistics data can not be used
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册