From 2da08076ced278c48da4250450ca04f7871f4a78 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 10 Jun 2022 14:49:49 +0800 Subject: [PATCH 1/2] fix(query): add value check. --- source/libs/function/src/tpercentile.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/source/libs/function/src/tpercentile.c b/source/libs/function/src/tpercentile.c index 90d0640f40..b40dd8b78d 100644 --- a/source/libs/function/src/tpercentile.c +++ b/source/libs/function/src/tpercentile.c @@ -127,9 +127,11 @@ int32_t tBucketIntHash(tMemBucket *pBucket, const void *value) { int64_t delta = v - pBucket->range.i64MinVal; index = (delta % pBucket->numOfSlots); } else { - double slotSpan = (double)span / pBucket->numOfSlots; - index = (int32_t)((v - pBucket->range.i64MinVal) / slotSpan); - if (v == pBucket->range.i64MaxVal) { + double slotSpan = ((double)span) / pBucket->numOfSlots; + uint64_t delta = v - pBucket->range.i64MinVal; + + index = (int32_t)(delta / slotSpan); + if (v == pBucket->range.i64MaxVal || index == pBucket->numOfSlots) { index -= 1; } } @@ -324,7 +326,6 @@ int32_t tMemBucketPut(tMemBucket *pBucket, const void *data, size_t size) { int32_t bytes = pBucket->bytes; for (int32_t i = 0; i < size; ++i) { char *d = (char *) data + i * bytes; - int32_t index = (pBucket->hashFunc)(pBucket, d); if (index < 0) { continue; From 5f0f6f7c6351dcfaeadf59ae357ad31eb1f367d1 Mon Sep 17 00:00:00 2001 From: Haojun Liao Date: Fri, 10 Jun 2022 14:50:51 +0800 Subject: [PATCH 2/2] refactor: add log. --- source/client/src/clientImpl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 9025121854..65a91fe426 100644 --- a/source/client/src/clientImpl.c +++ b/source/client/src/clientImpl.c @@ -692,6 +692,7 @@ void launchAsyncQuery(SRequestObj* pRequest, SQuery* pQuery) { if (TSDB_CODE_SUCCESS == code) { code = qCreateQueryPlan(&cxt, &pRequest->body.pDag, pNodeList); + tscError("0x%"PRIx64" failed to create query plan, code:%s 0x%"PRIx64, pRequest->self, tstrerror(code), pRequest->requestId); } if (TSDB_CODE_SUCCESS == code) {