未验证 提交 e5aba0b0 编写于 作者: M Minglei Jin 提交者: GitHub

Merge pull request #13821 from taosdata/fix/TS-1605-V26

fix(query): V26 fixed group by col_proj_function des error on client. 
...@@ -3347,6 +3347,12 @@ static void col_project_function(SQLFunctionCtx *pCtx) { ...@@ -3347,6 +3347,12 @@ static void col_project_function(SQLFunctionCtx *pCtx) {
memcpy(pCtx->pOutput, pData, (size_t) numOfRows * pCtx->inputBytes); memcpy(pCtx->pOutput, pData, (size_t) numOfRows * pCtx->inputBytes);
} else { } else {
// DESC // 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) { for(int32_t i = 0; i < pCtx->size; ++i) {
char* dst = pCtx->pOutput + (pCtx->size - 1 - i) * pCtx->inputBytes; char* dst = pCtx->pOutput + (pCtx->size - 1 - i) * pCtx->inputBytes;
char* src = pData + i * pCtx->inputBytes; char* src = pData + i * pCtx->inputBytes;
......
...@@ -1713,7 +1713,8 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn ...@@ -1713,7 +1713,8 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn
longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_APP_ERROR); longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_APP_ERROR);
} }
doApplyFunctions(pRuntimeEnv, pInfo->binfo.pCtx, &w, j - num, num, tsList, pSDataBlock->info.rows, pOperator->numOfOutput); int32_t offset = QUERY_IS_ASC_QUERY(pQueryAttr) ? j - num : j - 1;
doApplyFunctions(pRuntimeEnv, pInfo->binfo.pCtx, &w, offset, num, tsList, pSDataBlock->info.rows, pOperator->numOfOutput);
num = 1; num = 1;
...@@ -1733,7 +1734,8 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn ...@@ -1733,7 +1734,8 @@ static void doHashGroupbyAgg(SOperatorInfo* pOperator, SGroupbyOperatorInfo *pIn
if (ret != TSDB_CODE_SUCCESS) { // null data, too many state code if (ret != TSDB_CODE_SUCCESS) { // null data, too many state code
longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_APP_ERROR); longjmp(pRuntimeEnv->env, TSDB_CODE_QRY_APP_ERROR);
} }
doApplyFunctions(pRuntimeEnv, pInfo->binfo.pCtx, &w, pSDataBlock->info.rows - num, num, tsList, pSDataBlock->info.rows, pOperator->numOfOutput); int32_t offset = QUERY_IS_ASC_QUERY(pQueryAttr) ? pSDataBlock->info.rows - num : pSDataBlock->info.rows - 1;
doApplyFunctions(pRuntimeEnv, pInfo->binfo.pCtx, &w, offset, num, tsList, pSDataBlock->info.rows, pOperator->numOfOutput);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册