From c765f363cd88e30c875a72b076fdd001d61f07b1 Mon Sep 17 00:00:00 2001 From: haojun Liao Date: Fri, 31 Jan 2020 23:19:13 +0800 Subject: [PATCH 1/2] Update vnodeShell.c --- src/system/detail/src/vnodeShell.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/system/detail/src/vnodeShell.c b/src/system/detail/src/vnodeShell.c index 1b442be5ff..63fe24b06a 100644 --- a/src/system/detail/src/vnodeShell.c +++ b/src/system/detail/src/vnodeShell.c @@ -485,7 +485,7 @@ void vnodeExecuteRetrieveReq(SSchedMsg *pSched) { // write the progress information of each meter to response // this is required by subscriptions - if (pQInfo->pMeterQuerySupporter != NULL) { + if (pQInfo->pMeterQuerySupporter != NULL && pQInfo->pMeterQuerySupporter->pMeterSidExtInfo != NULL) { *((int32_t*)pMsg) = htonl(pQInfo->pMeterQuerySupporter->numOfMeters); pMsg += sizeof(int32_t); for (int32_t i = 0; i < pQInfo->pMeterQuerySupporter->numOfMeters; i++) { From d80ec2aad82d4075238ff2e8cf464bf0cd85f1a1 Mon Sep 17 00:00:00 2001 From: hjxilinx Date: Fri, 31 Jan 2020 23:29:39 +0800 Subject: [PATCH 2/2] fix bugs #1170. [tbase-1492] --- src/client/src/tscFunctionImpl.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/client/src/tscFunctionImpl.c b/src/client/src/tscFunctionImpl.c index 22875593c2..058a0e045b 100644 --- a/src/client/src/tscFunctionImpl.c +++ b/src/client/src/tscFunctionImpl.c @@ -3024,14 +3024,14 @@ static void diff_function(SQLFunctionCtx *pCtx) { if (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet pCtx->param[1].i64Key = pData[i]; pCtx->param[1].nType = pCtx->inputType; - } else if (i == 0) { + } else if ((i == 0 && pCtx->order == TSQL_SO_ASC) || (i == pCtx->size - 1 && pCtx->order == TSQL_SO_DESC)) { *pOutput = pData[i] - pCtx->param[1].i64Key; *pTimestamp = pCtx->ptsList[i]; pOutput += step; pTimestamp += step; } else { - *pOutput = pData[i] - pData[i - 1]; + *pOutput = pData[i] - pData[i - step]; *pTimestamp = pCtx->ptsList[i]; pOutput += step; @@ -3056,13 +3056,13 @@ static void diff_function(SQLFunctionCtx *pCtx) { if (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet pCtx->param[1].dKey = pData[i]; pCtx->param[1].nType = pCtx->inputType; - } else if (i == 0) { + } else if ((i == 0 && pCtx->order == TSQL_SO_ASC) || (i == pCtx->size - 1 && pCtx->order == TSQL_SO_DESC)) { *pOutput = pData[i] - pCtx->param[1].dKey; *pTimestamp = pCtx->ptsList[i]; pOutput += step; pTimestamp += step; } else { - *pOutput = pData[i] - pData[i - 1]; + *pOutput = pData[i] - pData[i - step]; *pTimestamp = pCtx->ptsList[i]; pOutput += step; pTimestamp += step; @@ -3086,13 +3086,13 @@ static void diff_function(SQLFunctionCtx *pCtx) { if (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet pCtx->param[1].dKey = pData[i]; pCtx->param[1].nType = pCtx->inputType; - } else if (i == 0) { + } else if ((i == 0 && pCtx->order == TSQL_SO_ASC) || (i == pCtx->size - 1 && pCtx->order == TSQL_SO_DESC)) { *pOutput = pData[i] - pCtx->param[1].dKey; *pTimestamp = pCtx->ptsList[i]; pOutput += step; pTimestamp += step; } else { - *pOutput = pData[i] - pData[i - 1]; + *pOutput = pData[i] - pData[i - step]; *pTimestamp = pCtx->ptsList[i]; pOutput += step; pTimestamp += step; @@ -3117,13 +3117,13 @@ static void diff_function(SQLFunctionCtx *pCtx) { if (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet pCtx->param[1].i64Key = pData[i]; pCtx->param[1].nType = pCtx->inputType; - } else if (i == 0) { + } else if ((i == 0 && pCtx->order == TSQL_SO_ASC) || (i == pCtx->size - 1 && pCtx->order == TSQL_SO_DESC)) { *pOutput = pData[i] - pCtx->param[1].i64Key; *pTimestamp = pCtx->ptsList[i]; pOutput += step; pTimestamp += step; } else { - *pOutput = pData[i] - pData[i - 1]; + *pOutput = pData[i] - pData[i - step]; *pTimestamp = pCtx->ptsList[i]; pOutput += step; pTimestamp += step; @@ -3147,13 +3147,13 @@ static void diff_function(SQLFunctionCtx *pCtx) { if (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet pCtx->param[1].i64Key = pData[i]; pCtx->param[1].nType = pCtx->inputType; - } else if (i == 0) { + } else if ((i == 0 && pCtx->order == TSQL_SO_ASC) || (i == pCtx->size - 1 && pCtx->order == TSQL_SO_DESC)) { *pOutput = pData[i] - pCtx->param[1].i64Key; *pTimestamp = pCtx->ptsList[i]; pOutput += step; pTimestamp += step; } else { - *pOutput = pData[i] - pData[i - 1]; + *pOutput = pData[i] - pData[i - step]; *pTimestamp = pCtx->ptsList[i]; pOutput += step; pTimestamp += step;