diff --git a/source/client/src/clientImpl.c b/source/client/src/clientImpl.c index 90251218540230aaf1e7583b6d989cb06520ec87..65a91fe42642346a66b4f399fac89dbb849cb447 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) { diff --git a/source/libs/function/src/tpercentile.c b/source/libs/function/src/tpercentile.c index 90d0640f403ef3be0949f52d1313b715b225ced0..b40dd8b78da4860c18df56b3c0da7f668a2ce5d1 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;