未验证 提交 b7f8774f 编写于 作者: H Haojun Liao 提交者: GitHub

Merge pull request #10425 from taosdata/fix/TS-1215-V24

[TS-1215]<fix>(query): V24->memcpy with real length of data on DESC
......@@ -2991,12 +2991,18 @@ static void col_project_function(SQLFunctionCtx *pCtx) {
char *pData = GET_INPUT_DATA_LIST(pCtx);
if (pCtx->order == TSDB_ORDER_ASC) {
// ASC
int32_t numOfRows = (pCtx->param[0].i64 == 1)? 1:pCtx->size;
memcpy(pCtx->pOutput, pData, (size_t) numOfRows * pCtx->inputBytes);
} else {
// DESC
for(int32_t i = 0; i < pCtx->size; ++i) {
memcpy(pCtx->pOutput + (pCtx->size - 1 - i) * pCtx->inputBytes, pData + i * pCtx->inputBytes,
pCtx->inputBytes);
char* dst = pCtx->pOutput + (pCtx->size - 1 - i) * pCtx->inputBytes;
char* src = pData + i * pCtx->inputBytes;
if (IS_VAR_DATA_TYPE(pCtx->inputType))
varDataCopy(dst, src);
else
memcpy(dst, src, pCtx->inputBytes);
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册