提交 969331c4 编写于 作者: H Haojun Liao

refactor: do some internal refactor.

上级 f4f27741
...@@ -495,29 +495,6 @@ static void handleInt64Col(const void* data, int32_t start, int32_t numOfRows, S ...@@ -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) { ...@@ -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) { ...@@ -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) { ...@@ -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) { ...@@ -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;
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册