Merge pull request #12445 from taosdata/feature/udf
feat: fix erros of square int overflow and block capacity set before filling a new column
This commit is contained in:
commit
095217a204
|
@ -897,6 +897,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc
|
||||||
scalarCalculate(pExpr[k].pExpr->_optrRoot.pRootNode, pBlockList, &dest);
|
scalarCalculate(pExpr[k].pExpr->_optrRoot.pRootNode, pBlockList, &dest);
|
||||||
|
|
||||||
int32_t startOffset = createNewColModel ? 0 : pResult->info.rows;
|
int32_t startOffset = createNewColModel ? 0 : pResult->info.rows;
|
||||||
|
colInfoDataEnsureCapacity(pResColData, startOffset, pResult->info.capacity);
|
||||||
colDataMergeCol(pResColData, startOffset, &pResult->info.capacity, &idata, dest.numOfRows);
|
colDataMergeCol(pResColData, startOffset, &pResult->info.capacity, &idata, dest.numOfRows);
|
||||||
|
|
||||||
numOfRows = dest.numOfRows;
|
numOfRows = dest.numOfRows;
|
||||||
|
@ -936,6 +937,7 @@ int32_t projectApplyFunctions(SExprInfo* pExpr, SSDataBlock* pResult, SSDataBloc
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t startOffset = createNewColModel ? 0 : pResult->info.rows;
|
int32_t startOffset = createNewColModel ? 0 : pResult->info.rows;
|
||||||
|
colInfoDataEnsureCapacity(pResColData, startOffset, pResult->info.capacity);
|
||||||
colDataMergeCol(pResColData, startOffset, &pResult->info.capacity, &idata, dest.numOfRows);
|
colDataMergeCol(pResColData, startOffset, &pResult->info.capacity, &idata, dest.numOfRows);
|
||||||
|
|
||||||
numOfRows = dest.numOfRows;
|
numOfRows = dest.numOfRows;
|
||||||
|
|
|
@ -44,7 +44,7 @@ int32_t udf2(SUdfDataBlock* block, SUdfInterBuf *interBuf, SUdfInterBuf *newInte
|
||||||
case TSDB_DATA_TYPE_INT: {
|
case TSDB_DATA_TYPE_INT: {
|
||||||
char* cell = udfColDataGetData(col, j);
|
char* cell = udfColDataGetData(col, j);
|
||||||
int32_t num = *(int32_t*)cell;
|
int32_t num = *(int32_t*)cell;
|
||||||
sumSquares += num * num;
|
sumSquares += (double)num * num;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TSDB_DATA_TYPE_DOUBLE: {
|
case TSDB_DATA_TYPE_DOUBLE: {
|
||||||
|
|
Loading…
Reference in New Issue