Merge pull request #15443 from taosdata/enh/TD-17659
fix(query): fix sum/max/min null input
This commit is contained in:
commit
c74c52d10c
|
@ -466,7 +466,7 @@ int32_t functionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
|||
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
|
||||
|
||||
SResultRowEntryInfo* pResInfo = GET_RES_INFO(pCtx);
|
||||
pResInfo->isNullRes = (pResInfo->numOfRes == 0) ? 1 : 0;
|
||||
pResInfo->isNullRes = (pResInfo->isNullRes == 1) ? 1 : (pResInfo->numOfRes == 0);
|
||||
|
||||
char* in = GET_ROWCELL_INTERBUF(pResInfo);
|
||||
colDataAppend(pCol, pBlock->info.rows, in, pResInfo->isNullRes);
|
||||
|
@ -663,7 +663,8 @@ int32_t sumFunction(SqlFunctionCtx* pCtx) {
|
|||
|
||||
// check for overflow
|
||||
if (IS_FLOAT_TYPE(type) && (isinf(pSumRes->dsum) || isnan(pSumRes->dsum))) {
|
||||
numOfElem = 0;
|
||||
GET_RES_INFO(pCtx)->isNullRes = 1;
|
||||
numOfElem = 1;
|
||||
}
|
||||
|
||||
_sum_over:
|
||||
|
@ -1605,7 +1606,7 @@ int32_t minmaxFunctionFinalize(SqlFunctionCtx* pCtx, SSDataBlock* pBlock) {
|
|||
int32_t currentRow = pBlock->info.rows;
|
||||
|
||||
SColumnInfoData* pCol = taosArrayGet(pBlock->pDataBlock, slotId);
|
||||
pEntryInfo->isNullRes = (pEntryInfo->numOfRes == 0);
|
||||
pEntryInfo->isNullRes = (pEntryInfo->isNullRes == 1) ? 1 : (pEntryInfo->numOfRes == 0);
|
||||
|
||||
if (pCol->info.type == TSDB_DATA_TYPE_FLOAT) {
|
||||
float v = *(double*)&pRes->v;
|
||||
|
|
|
@ -83,22 +83,22 @@ if $data11 != 3 then
|
|||
goto loop0
|
||||
endi
|
||||
|
||||
if $data12 != 10 then
|
||||
if $data12 != NULL then
|
||||
print ======data12=$data12
|
||||
goto loop0
|
||||
endi
|
||||
|
||||
if $data13 != 10 then
|
||||
if $data13 != NULL then
|
||||
print ======data13=$data13
|
||||
goto loop0
|
||||
endi
|
||||
|
||||
if $data14 != 1.100000000 then
|
||||
if $data14 != NULL then
|
||||
print ======data14=$data14
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data15 != 0.000000000 then
|
||||
if $data15 != NULL then
|
||||
print ======data15=$data15
|
||||
return -1
|
||||
endi
|
||||
|
@ -141,22 +141,22 @@ if $data01 != 7 then
|
|||
goto loop1
|
||||
endi
|
||||
|
||||
if $data02 != 18 then
|
||||
if $data02 != NULL then
|
||||
print =====data02=$data02
|
||||
goto loop1
|
||||
endi
|
||||
|
||||
if $data03 != 4 then
|
||||
if $data03 != NULL then
|
||||
print =====data03=$data03
|
||||
goto loop1
|
||||
endi
|
||||
|
||||
if $data04 != 1.000000000 then
|
||||
if $data04 != NULL then
|
||||
print ======$data04
|
||||
return -1
|
||||
endi
|
||||
|
||||
if $data05 != 1.154700538 then
|
||||
if $data05 != NULL then
|
||||
print ======$data05
|
||||
return -1
|
||||
endi
|
||||
|
|
Loading…
Reference in New Issue