enh(query): improve the perf.
This commit is contained in:
parent
9863879951
commit
2621dec4ae
|
@ -1555,6 +1555,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
|
|||
pBuf->assign = true;
|
||||
} else {
|
||||
// ignore the equivalent data value
|
||||
#if 0
|
||||
if ((*val) == pData[i]) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1565,6 +1566,23 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
|
|||
updateTupleData(pCtx, i, pCtx->pSrcBlock, &pBuf->tuplePos);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// NOTE: An faster version to avoid one additional comparison with FPU.
|
||||
if (isMinFunc) { // min
|
||||
if (*val < pData[i]) {
|
||||
*val = pData[i];
|
||||
if (pCtx->subsidiaries.num > 0) {
|
||||
updateTupleData(pCtx, i, pCtx->pSrcBlock, &pBuf->tuplePos);
|
||||
}
|
||||
}
|
||||
} else { // max
|
||||
if (*val > pData[i]) {
|
||||
*val = pData[i];
|
||||
if (pCtx->subsidiaries.num > 0) {
|
||||
updateTupleData(pCtx, i, pCtx->pSrcBlock, &pBuf->tuplePos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
numOfElems += 1;
|
||||
|
|
Loading…
Reference in New Issue