Merge branch 'develop' into feature/slguan

This commit is contained in:
slguan 2020-02-01 15:57:13 +08:00
commit 29fe60b2ca
2 changed files with 11 additions and 11 deletions

View File

@ -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 if (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet
pCtx->param[1].i64Key = pData[i]; pCtx->param[1].i64Key = pData[i];
pCtx->param[1].nType = pCtx->inputType; 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; *pOutput = pData[i] - pCtx->param[1].i64Key;
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += step; pOutput += step;
pTimestamp += step; pTimestamp += step;
} else { } else {
*pOutput = pData[i] - pData[i - 1]; *pOutput = pData[i] - pData[i - step];
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += step; 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 if (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet
pCtx->param[1].dKey = pData[i]; pCtx->param[1].dKey = pData[i];
pCtx->param[1].nType = pCtx->inputType; 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; *pOutput = pData[i] - pCtx->param[1].dKey;
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += step; pOutput += step;
pTimestamp += step; pTimestamp += step;
} else { } else {
*pOutput = pData[i] - pData[i - 1]; *pOutput = pData[i] - pData[i - step];
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += step; pOutput += step;
pTimestamp += 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 if (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet
pCtx->param[1].dKey = pData[i]; pCtx->param[1].dKey = pData[i];
pCtx->param[1].nType = pCtx->inputType; 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; *pOutput = pData[i] - pCtx->param[1].dKey;
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += step; pOutput += step;
pTimestamp += step; pTimestamp += step;
} else { } else {
*pOutput = pData[i] - pData[i - 1]; *pOutput = pData[i] - pData[i - step];
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += step; pOutput += step;
pTimestamp += 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 if (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet
pCtx->param[1].i64Key = pData[i]; pCtx->param[1].i64Key = pData[i];
pCtx->param[1].nType = pCtx->inputType; 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; *pOutput = pData[i] - pCtx->param[1].i64Key;
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += step; pOutput += step;
pTimestamp += step; pTimestamp += step;
} else { } else {
*pOutput = pData[i] - pData[i - 1]; *pOutput = pData[i] - pData[i - step];
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += step; pOutput += step;
pTimestamp += 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 if (pCtx->param[1].nType == INITIAL_VALUE_NOT_ASSIGNED) { // initial value is not set yet
pCtx->param[1].i64Key = pData[i]; pCtx->param[1].i64Key = pData[i];
pCtx->param[1].nType = pCtx->inputType; 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; *pOutput = pData[i] - pCtx->param[1].i64Key;
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += step; pOutput += step;
pTimestamp += step; pTimestamp += step;
} else { } else {
*pOutput = pData[i] - pData[i - 1]; *pOutput = pData[i] - pData[i - step];
*pTimestamp = pCtx->ptsList[i]; *pTimestamp = pCtx->ptsList[i];
pOutput += step; pOutput += step;
pTimestamp += step; pTimestamp += step;

View File

@ -485,7 +485,7 @@ void vnodeExecuteRetrieveReq(SSchedMsg *pSched) {
// write the progress information of each meter to response // write the progress information of each meter to response
// this is required by subscriptions // this is required by subscriptions
if (pQInfo->pMeterQuerySupporter != NULL) { if (pQInfo->pMeterQuerySupporter != NULL && pQInfo->pMeterQuerySupporter->pMeterSidExtInfo != NULL) {
*((int32_t*)pMsg) = htonl(pQInfo->pMeterQuerySupporter->numOfMeters); *((int32_t*)pMsg) = htonl(pQInfo->pMeterQuerySupporter->numOfMeters);
pMsg += sizeof(int32_t); pMsg += sizeof(int32_t);
for (int32_t i = 0; i < pQInfo->pMeterQuerySupporter->numOfMeters; i++) { for (int32_t i = 0; i < pQInfo->pMeterQuerySupporter->numOfMeters; i++) {