From 993be0518a0c1ce2029539c5292f15f414a5d60a Mon Sep 17 00:00:00 2001 From: dengyihao Date: Sun, 14 Jun 2020 12:49:29 +0800 Subject: [PATCH 1/2] fix coverity issues --- src/query/src/qast.c | 3 +-- src/query/src/qpercentile.c | 2 +- src/query/src/qtokenizer.c | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/query/src/qast.c b/src/query/src/qast.c index 8d2202563d..36a91ee545 100644 --- a/src/query/src/qast.c +++ b/src/query/src/qast.c @@ -577,8 +577,7 @@ static void tQueryIndexColumn(SSkipList* pSkipList, tQueryInfo* pQueryInfo, SArr assert(0); } } else { - int32_t optr = cond.end->optr; - + int32_t optr = cond.end ? cond.end->optr : TSDB_RELATION_INVALID; if (optr == TSDB_RELATION_LESS || optr == TSDB_RELATION_LESS_EQUAL) { bool comp = true; int32_t ret = 0; diff --git a/src/query/src/qpercentile.c b/src/query/src/qpercentile.c index 367028928b..577fddb808 100644 --- a/src/query/src/qpercentile.c +++ b/src/query/src/qpercentile.c @@ -283,7 +283,7 @@ tMemBucket *tMemBucketCreate(int32_t totalSlots, int32_t nBufferSize, int16_t nE break; }; default: { - uError("MemBucket:%p,not support data type %d,failed", *pBucket, pBucket->dataType); + uError("MemBucket:%p,not support data type %d,failed", pBucket, pBucket->dataType); tfree(pBucket); return NULL; } diff --git a/src/query/src/qtokenizer.c b/src/query/src/qtokenizer.c index e6340cc678..aa9f6fddca 100644 --- a/src/query/src/qtokenizer.c +++ b/src/query/src/qtokenizer.c @@ -655,4 +655,4 @@ SSQLToken tStrGetToken(char* str, int32_t* i, bool isPrevOptr, uint32_t numOfIgn return t0; } -bool isKeyWord(const char* z, int32_t len) { return (tSQLKeywordCode((char*)z, len) != TK_ID); } \ No newline at end of file +bool isKeyWord(const char* z, int32_t len) { return (tSQLKeywordCode((char*)z, len) != TK_ID); } From 2c170d658fd2b625ba6e33434a2e0586e5f3b417 Mon Sep 17 00:00:00 2001 From: dengyihao Date: Sun, 14 Jun 2020 13:17:55 +0800 Subject: [PATCH 2/2] fix coverity issues --- src/query/src/qExecutor.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/query/src/qExecutor.c b/src/query/src/qExecutor.c index d9c725a4f5..618051aab2 100644 --- a/src/query/src/qExecutor.c +++ b/src/query/src/qExecutor.c @@ -4229,7 +4229,7 @@ static void sequentialTableProcess(SQInfo *pQInfo) { while (pQInfo->groupIndex < numOfGroups) { SArray* group = taosArrayGetP(pQInfo->groupInfo.pGroupList, pQInfo->groupIndex); - qTrace("QInfo:%p last_row query on group:%d, total group:%d, current group:%d", pQInfo, pQInfo->groupIndex, + qTrace("QInfo:%p last_row query on group:%d, total group:%u, current group:%p", pQInfo, pQInfo->groupIndex, numOfGroups, group); STsdbQueryCond cond = { @@ -4476,7 +4476,7 @@ static void sequentialTableProcess(SQInfo *pQInfo) { } qTrace( - "QInfo %p numOfTables:%d, index:%d, numOfGroups:%d, %d points returned, total:%"PRId64", offset:%" PRId64, + "QInfo %p numOfTables:%"PRIu64", index:%d, numOfGroups:%d, %"PRId64" points returned, total:%"PRId64", offset:%" PRId64, pQInfo, pQInfo->groupInfo.numOfTables, pQInfo->tableIndex, numOfGroups, pQuery->rec.rows, pQuery->rec.total, pQuery->limit.offset); } @@ -4563,7 +4563,7 @@ static void multiTableQueryProcess(SQInfo *pQInfo) { copyFromWindowResToSData(pQInfo, pRuntimeEnv->windowResInfo.pResult); } - qTrace("QInfo:%p current:%lld, total:%lld", pQInfo, pQuery->rec.rows, pQuery->rec.total); + qTrace("QInfo:%p current:%"PRId64", total:%"PRId64"", pQInfo, pQuery->rec.rows, pQuery->rec.total); return; } @@ -4835,13 +4835,13 @@ static void tableQueryImpl(SQInfo *pQInfo) { clearFirstNTimeWindow(pRuntimeEnv, pQInfo->groupIndex); if (pQuery->rec.rows > 0) { - qTrace("QInfo:%p %d rows returned from group results, total:%d", pQInfo, pQuery->rec.rows, pQuery->rec.total); + qTrace("QInfo:%p %"PRId64" rows returned from group results, total:%"PRId64"", pQInfo, pQuery->rec.rows, pQuery->rec.total); return; } } } - qTrace("QInfo:%p query over, %d rows are returned", pQInfo, pQuery->rec.total); + qTrace("QInfo:%p query over, %"PRId64" rows are returned", pQInfo, pQuery->rec.total); return; } @@ -4897,7 +4897,7 @@ static void stableQueryImpl(SQInfo *pQInfo) { pQInfo->runtimeEnv.summary.elapsedTime += (taosGetTimestampUs() - st); if (pQuery->rec.rows == 0) { - qTrace("QInfo:%p over, %d tables queried, %d rows are returned", pQInfo, pQInfo->groupInfo.numOfTables, pQuery->rec.total); + qTrace("QInfo:%p over, %d tables queried, %"PRId64" rows are returned", pQInfo, pQInfo->groupInfo.numOfTables, pQuery->rec.total); } } @@ -6009,7 +6009,7 @@ int32_t qRetrieveQueryResultInfo(qinfo_t qinfo) { } sem_wait(&pQInfo->dataReady); - qTrace("QInfo:%p retrieve result info, rowsize:%d, rows:%d, code:%d", pQInfo, pQuery->rowSize, pQuery->rec.rows, + qTrace("QInfo:%p retrieve result info, rowsize:%d, rows:%"PRId64", code:%d", pQInfo, pQuery->rowSize, pQuery->rec.rows, pQInfo->code); return pQInfo->code;