Merge pull request #19089 from taosdata/fix/TS-2286
fix: fill null value issue
This commit is contained in:
commit
2e0903a9f2
|
@ -170,6 +170,7 @@ static SSDataBlock* doFillImpl(SOperatorInfo* pOperator) {
|
||||||
// Fill the previous group data block, before handle the data block of new group.
|
// Fill the previous group data block, before handle the data block of new group.
|
||||||
// Close the fill operation for previous group data block
|
// Close the fill operation for previous group data block
|
||||||
taosFillSetStartInfo(pInfo->pFillInfo, 0, pInfo->win.ekey);
|
taosFillSetStartInfo(pInfo->pFillInfo, 0, pInfo->win.ekey);
|
||||||
|
pInfo->pFillInfo->prev.key = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,22 @@
|
||||||
|
|
||||||
static void doSetVal(SColumnInfoData* pDstColInfoData, int32_t rowIndex, const SGroupKeys* pKey);
|
static void doSetVal(SColumnInfoData* pDstColInfoData, int32_t rowIndex, const SGroupKeys* pKey);
|
||||||
|
|
||||||
|
static void setNotFillColumn(SFillInfo* pFillInfo, SColumnInfoData* pDstColInfo, int32_t rowIndex, int32_t colIdx) {
|
||||||
|
SRowVal* p = NULL;
|
||||||
|
if (FILL_IS_ASC_FILL(pFillInfo)) {
|
||||||
|
if (pFillInfo->prev.key != 0) {
|
||||||
|
p = &pFillInfo->prev; // prev has been set value
|
||||||
|
} else { // otherwise, use the value in the next row
|
||||||
|
p = &pFillInfo->next;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
p = &pFillInfo->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
SGroupKeys* pKey = taosArrayGet(p->pRowVal, colIdx);
|
||||||
|
doSetVal(pDstColInfo, rowIndex, pKey);
|
||||||
|
}
|
||||||
|
|
||||||
static void setNullRow(SSDataBlock* pBlock, SFillInfo* pFillInfo, int32_t rowIndex) {
|
static void setNullRow(SSDataBlock* pBlock, SFillInfo* pFillInfo, int32_t rowIndex) {
|
||||||
for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
|
for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
|
||||||
SFillColInfo* pCol = &pFillInfo->pFillCol[i];
|
SFillColInfo* pCol = &pFillInfo->pFillCol[i];
|
||||||
|
@ -45,19 +61,7 @@ static void setNullRow(SSDataBlock* pBlock, SFillInfo* pFillInfo, int32_t rowInd
|
||||||
if (pCol->notFillCol) {
|
if (pCol->notFillCol) {
|
||||||
bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfo, rowIndex);
|
bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfo, rowIndex);
|
||||||
if (!filled) {
|
if (!filled) {
|
||||||
SRowVal* p = NULL;
|
setNotFillColumn(pFillInfo, pDstColInfo, rowIndex, i);
|
||||||
if (FILL_IS_ASC_FILL(pFillInfo)) {
|
|
||||||
if (pFillInfo->prev.key != 0) {
|
|
||||||
p = &pFillInfo->prev; // prev has been set value
|
|
||||||
} else { // otherwise, use the value in the next row
|
|
||||||
p = &pFillInfo->next;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
p = &pFillInfo->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
SGroupKeys* pKey = taosArrayGet(p->pRowVal, i);
|
|
||||||
doSetVal(pDstColInfo, rowIndex, pKey);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
colDataAppendNULL(pDstColInfo, rowIndex);
|
colDataAppendNULL(pDstColInfo, rowIndex);
|
||||||
|
@ -124,28 +128,23 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock*
|
||||||
|
|
||||||
// set the other values
|
// set the other values
|
||||||
if (pFillInfo->type == TSDB_FILL_PREV) {
|
if (pFillInfo->type == TSDB_FILL_PREV) {
|
||||||
SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal;
|
|
||||||
|
|
||||||
for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
|
for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
|
||||||
SFillColInfo* pCol = &pFillInfo->pFillCol[i];
|
SFillColInfo* pCol = &pFillInfo->pFillCol[i];
|
||||||
|
|
||||||
SColumnInfoData* pDstColInfoData = taosArrayGet(pBlock->pDataBlock, GET_DEST_SLOT_ID(pCol));
|
SColumnInfoData* pDstColInfoData = taosArrayGet(pBlock->pDataBlock, GET_DEST_SLOT_ID(pCol));
|
||||||
bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfoData, index);
|
bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfoData, index);
|
||||||
if (!filled) {
|
if (!filled) {
|
||||||
SGroupKeys* pKey = taosArrayGet(p, i);
|
setNotFillColumn(pFillInfo, pDstColInfoData, index, i);
|
||||||
doSetVal(pDstColInfoData, index, pKey);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (pFillInfo->type == TSDB_FILL_NEXT) {
|
} else if (pFillInfo->type == TSDB_FILL_NEXT) {
|
||||||
SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->next.pRowVal : pFillInfo->prev.pRowVal;
|
|
||||||
// todo refactor: start from 0 not 1
|
// todo refactor: start from 0 not 1
|
||||||
for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
|
for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
|
||||||
SFillColInfo* pCol = &pFillInfo->pFillCol[i];
|
SFillColInfo* pCol = &pFillInfo->pFillCol[i];
|
||||||
SColumnInfoData* pDstColInfoData = taosArrayGet(pBlock->pDataBlock, GET_DEST_SLOT_ID(pCol));
|
SColumnInfoData* pDstColInfoData = taosArrayGet(pBlock->pDataBlock, GET_DEST_SLOT_ID(pCol));
|
||||||
bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfoData, index);
|
bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfoData, index);
|
||||||
if (!filled) {
|
if (!filled) {
|
||||||
SGroupKeys* pKey = taosArrayGet(p, i);
|
setNotFillColumn(pFillInfo, pDstColInfoData, index, i);
|
||||||
doSetVal(pDstColInfoData, index, pKey);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (pFillInfo->type == TSDB_FILL_LINEAR) {
|
} else if (pFillInfo->type == TSDB_FILL_LINEAR) {
|
||||||
|
@ -163,9 +162,7 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock*
|
||||||
if (pCol->notFillCol) {
|
if (pCol->notFillCol) {
|
||||||
bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstCol, index);
|
bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstCol, index);
|
||||||
if (!filled) {
|
if (!filled) {
|
||||||
SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal;
|
setNotFillColumn(pFillInfo, pDstCol, index, i);
|
||||||
SGroupKeys* pKey = taosArrayGet(p, i);
|
|
||||||
doSetVal(pDstCol, index, pKey);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SGroupKeys* pKey = taosArrayGet(pFillInfo->prev.pRowVal, i);
|
SGroupKeys* pKey = taosArrayGet(pFillInfo->prev.pRowVal, i);
|
||||||
|
@ -205,9 +202,7 @@ static void doFillOneRow(SFillInfo* pFillInfo, SSDataBlock* pBlock, SSDataBlock*
|
||||||
if (pCol->notFillCol) {
|
if (pCol->notFillCol) {
|
||||||
bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDst, index);
|
bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDst, index);
|
||||||
if (!filled) {
|
if (!filled) {
|
||||||
SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal;
|
setNotFillColumn(pFillInfo, pDst, index, i);
|
||||||
SGroupKeys* pKey = taosArrayGet(p, i);
|
|
||||||
doSetVal(pDst, index, pKey);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SVariant* pVar = &pFillInfo->pFillCol[i].fillVal;
|
SVariant* pVar = &pFillInfo->pFillCol[i].fillVal;
|
||||||
|
|
Loading…
Reference in New Issue