Merge pull request #4127 from taosdata/hotfix/TD-1937
[TD-1937]<fix>:client crash on percentile
This commit is contained in:
commit
4f3d28a911
|
@ -97,6 +97,9 @@ static void tscInitSqlContext(SSqlCmd *pCmd, SLocalReducer *pReducer, tOrderDesc
|
||||||
pCtx->param[2].i64Key = pQueryInfo->order.order;
|
pCtx->param[2].i64Key = pQueryInfo->order.order;
|
||||||
pCtx->param[2].nType = TSDB_DATA_TYPE_BIGINT;
|
pCtx->param[2].nType = TSDB_DATA_TYPE_BIGINT;
|
||||||
pCtx->param[1].i64Key = pQueryInfo->order.orderColId;
|
pCtx->param[1].i64Key = pQueryInfo->order.orderColId;
|
||||||
|
} else if (functionId == TSDB_FUNC_APERCT) {
|
||||||
|
pCtx->param[0].i64Key = pExpr->param[0].i64Key;
|
||||||
|
pCtx->param[0].nType = pExpr->param[0].nType;
|
||||||
}
|
}
|
||||||
|
|
||||||
pCtx->interBufBytes = pExpr->interBytes;
|
pCtx->interBufBytes = pExpr->interBytes;
|
||||||
|
|
|
@ -168,7 +168,7 @@ int32_t tHistogramAdd(SHistogramInfo** pHisto, double val) {
|
||||||
(*pHisto)->numOfEntries += 1;
|
(*pHisto)->numOfEntries += 1;
|
||||||
}
|
}
|
||||||
} else { /* insert a new slot */
|
} else { /* insert a new slot */
|
||||||
if ((*pHisto)->numOfElems > 1 && idx < (*pHisto)->numOfEntries) {
|
if ((*pHisto)->numOfElems >= 1 && idx < (*pHisto)->numOfEntries) {
|
||||||
if (idx > 0) {
|
if (idx > 0) {
|
||||||
assert((*pHisto)->elems[idx - 1].val <= val);
|
assert((*pHisto)->elems[idx - 1].val <= val);
|
||||||
}
|
}
|
||||||
|
@ -661,4 +661,4 @@ SHistogramInfo* tHistogramMerge(SHistogramInfo* pHisto1, SHistogramInfo* pHisto2
|
||||||
|
|
||||||
free(pHistoBins);
|
free(pHistoBins);
|
||||||
return pResHistogram;
|
return pResHistogram;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue