refactor: do some internal refactor.
This commit is contained in:
parent
f4f2774100
commit
969331c49e
|
@ -495,29 +495,6 @@ static void handleInt64Col(const void* data, int32_t start, int32_t numOfRows, S
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void handleUint8Col(SColumnInfoData* pCol, int32_t start, int32_t numOfRows, SMinmaxResInfo* pBuf,
|
|
||||||
bool isMinFunc) {
|
|
||||||
const uint8_t* pData = (uint8_t*)pCol->pData;
|
|
||||||
uint8_t* val = (uint8_t*)&pBuf->v;
|
|
||||||
|
|
||||||
// AVX2 version to speedup the loop
|
|
||||||
if (tsAVX2Enable && tsSIMDEnable) {
|
|
||||||
*val = i8VectorCmpAVX2(pData, numOfRows, isMinFunc, false);
|
|
||||||
} else {
|
|
||||||
if (!pBuf->assign) {
|
|
||||||
*val = pData[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isMinFunc) { // min
|
|
||||||
__COMPARE_EXTRACT_MIN(start, start + numOfRows, *val, pData);
|
|
||||||
} else {
|
|
||||||
__COMPARE_EXTRACT_MAX(start, start + numOfRows, *val, pData);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pBuf->assign = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void handleFloatCol(SColumnInfoData* pCol, int32_t start, int32_t numOfRows, SMinmaxResInfo* pBuf, bool isMinFunc) {
|
static void handleFloatCol(SColumnInfoData* pCol, int32_t start, int32_t numOfRows, SMinmaxResInfo* pBuf, bool isMinFunc) {
|
||||||
float* pData = (float*)pCol->pData;
|
float* pData = (float*)pCol->pData;
|
||||||
float* val = (float*)&pBuf->v;
|
float* val = (float*)&pBuf->v;
|
||||||
|
@ -746,7 +723,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
|
||||||
ASSERT(pInput->numOfRows == pInput->totalRows && numOfElems >= 0);
|
ASSERT(pInput->numOfRows == pInput->totalRows && numOfElems >= 0);
|
||||||
|
|
||||||
if (numOfElems == 0) {
|
if (numOfElems == 0) {
|
||||||
return numOfElems;
|
goto _over;
|
||||||
}
|
}
|
||||||
|
|
||||||
void* tval = NULL;
|
void* tval = NULL;
|
||||||
|
@ -857,7 +834,7 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
|
||||||
} else {
|
} else {
|
||||||
numOfElems = numOfRows;
|
numOfElems = numOfRows;
|
||||||
|
|
||||||
switch(pCol->info.type) {
|
switch (pCol->info.type) {
|
||||||
case TSDB_DATA_TYPE_BOOL:
|
case TSDB_DATA_TYPE_BOOL:
|
||||||
case TSDB_DATA_TYPE_TINYINT: {
|
case TSDB_DATA_TYPE_TINYINT: {
|
||||||
handleInt8Col(pCol->pData, start, numOfRows, pBuf, isMinFunc, true);
|
handleInt8Col(pCol->pData, start, numOfRows, pBuf, isMinFunc, true);
|
||||||
|
@ -884,11 +861,11 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TSDB_DATA_TYPE_UINT: {
|
case TSDB_DATA_TYPE_UINT: {
|
||||||
handleInt16Col(pCol->pData, start, numOfRows, pBuf, isMinFunc, false);
|
handleInt32Col(pCol->pData, start, numOfRows, pBuf, isMinFunc, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TSDB_DATA_TYPE_UBIGINT: {
|
case TSDB_DATA_TYPE_UBIGINT: {
|
||||||
handleInt16Col(pCol->pData, start, numOfRows, pBuf, isMinFunc, false);
|
handleInt64Col(pCol->pData, start, numOfRows, pBuf, isMinFunc, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TSDB_DATA_TYPE_FLOAT: {
|
case TSDB_DATA_TYPE_FLOAT: {
|
||||||
|
@ -900,13 +877,13 @@ int32_t doMinMaxHelper(SqlFunctionCtx* pCtx, int32_t isMinFunc) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
_over:
|
_over:
|
||||||
if (numOfElems == 0 && pCtx->subsidiaries.num > 0 && !pBuf->nullTupleSaved) {
|
if (numOfElems == 0 && pCtx->subsidiaries.num > 0 && !pBuf->nullTupleSaved) {
|
||||||
pBuf->nullTuplePos = saveTupleData(pCtx, pInput->startRowIndex, pCtx->pSrcBlock, NULL);
|
pBuf->nullTuplePos = saveTupleData(pCtx, pInput->startRowIndex, pCtx->pSrcBlock, NULL);
|
||||||
pBuf->nullTupleSaved = true;
|
pBuf->nullTupleSaved = true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return numOfElems;
|
return numOfElems;
|
||||||
}
|
}
|
Loading…
Reference in New Issue