fix(query): fix apercentile crash when input is all null columns and used

with other non-null result functions

TD-17799
TD-17967
This commit is contained in:
Ganlin Zhao 2022-08-01 17:41:27 +08:00
parent 528a6890a0
commit 0dbe26f8bb
1 changed files with 4 additions and 12 deletions

View File

@ -2662,19 +2662,11 @@ int32_t apercentilePartialFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char)); char* res = taosMemoryCalloc(resultBytes + VARSTR_HEADER_SIZE, sizeof(char));
if (pInfo->algo == APERCT_ALGO_TDIGEST) { if (pInfo->algo == APERCT_ALGO_TDIGEST) {
if (pInfo->pTDigest->size > 0) { memcpy(varDataVal(res), pInfo, resultBytes);
memcpy(varDataVal(res), pInfo, resultBytes); varDataSetLen(res, resultBytes);
varDataSetLen(res, resultBytes);
} else {
return TSDB_CODE_SUCCESS;
}
} else { } else {
if (pInfo->pHisto->numOfElems > 0) { memcpy(varDataVal(res), pInfo, resultBytes);
memcpy(varDataVal(res), pInfo, resultBytes); varDataSetLen(res, resultBytes);
varDataSetLen(res, resultBytes);
} else {
return TSDB_CODE_SUCCESS;
}
} }
int32_t slotId = pCtx->pExpr->base.resSchema.slotId; int32_t slotId = pCtx->pExpr->base.resSchema.slotId;