[td-225]
This commit is contained in:
parent
2eb86a90ac
commit
86f935d4b0
|
@ -2675,6 +2675,8 @@ static void col_project_function(SQLFunctionCtx *pCtx) {
|
||||||
if (pCtx->numOfParams == 2) {
|
if (pCtx->numOfParams == 2) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// only one row is required.
|
||||||
if (pCtx->param[0].i64 == 1) {
|
if (pCtx->param[0].i64 == 1) {
|
||||||
SET_VAL(pCtx, pCtx->size, 1);
|
SET_VAL(pCtx, pCtx->size, 1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2683,7 +2685,8 @@ static void col_project_function(SQLFunctionCtx *pCtx) {
|
||||||
|
|
||||||
char *pData = GET_INPUT_DATA_LIST(pCtx);
|
char *pData = GET_INPUT_DATA_LIST(pCtx);
|
||||||
if (pCtx->order == TSDB_ORDER_ASC) {
|
if (pCtx->order == TSDB_ORDER_ASC) {
|
||||||
memcpy(pCtx->pOutput, pData, (size_t) pCtx->size * pCtx->inputBytes);
|
int32_t numOfRows = (pCtx->param[0].i64 == 1)? 1:pCtx->size;
|
||||||
|
memcpy(pCtx->pOutput, pData, (size_t) numOfRows * pCtx->inputBytes);
|
||||||
} else {
|
} else {
|
||||||
for(int32_t i = 0; i < pCtx->size; ++i) {
|
for(int32_t i = 0; i < pCtx->size; ++i) {
|
||||||
memcpy(pCtx->pOutput + (pCtx->size - 1 - i) * pCtx->inputBytes, pData + i * pCtx->inputBytes,
|
memcpy(pCtx->pOutput + (pCtx->size - 1 - i) * pCtx->inputBytes, pData + i * pCtx->inputBytes,
|
||||||
|
|
Loading…
Reference in New Issue