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;
|
pBuf->assign = true;
|
||||||
} else {
|
} else {
|
||||||
// ignore the equivalent data value
|
// ignore the equivalent data value
|
||||||
|
#if 0
|
||||||
if ((*val) == pData[i]) {
|
if ((*val) == pData[i]) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1565,6 +1566,23 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
|
||||||
updateTupleData(pCtx, i, pCtx->pSrcBlock, &pBuf->tuplePos);
|
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;
|
numOfElems += 1;
|
||||||
|
|
Loading…
Reference in New Issue