Merge pull request #19213 from taosdata/fix/TD-21555
fix:fill operator fill next issue
This commit is contained in:
commit
52cd40ea4f
|
@ -39,14 +39,10 @@ static void doSetVal(SColumnInfoData* pDstColInfoData, int32_t rowIndex, const S
|
||||||
|
|
||||||
static void setNotFillColumn(SFillInfo* pFillInfo, SColumnInfoData* pDstColInfo, int32_t rowIndex, int32_t colIdx) {
|
static void setNotFillColumn(SFillInfo* pFillInfo, SColumnInfoData* pDstColInfo, int32_t rowIndex, int32_t colIdx) {
|
||||||
SRowVal* p = NULL;
|
SRowVal* p = NULL;
|
||||||
if (FILL_IS_ASC_FILL(pFillInfo)) {
|
if (pFillInfo->type == TSDB_FILL_NEXT) {
|
||||||
if (pFillInfo->prev.key != 0) {
|
p = FILL_IS_ASC_FILL(pFillInfo) ? &pFillInfo->next : &pFillInfo->prev;
|
||||||
p = &pFillInfo->prev; // prev has been set value
|
|
||||||
} else { // otherwise, use the value in the next row
|
|
||||||
p = &pFillInfo->next;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
p = &pFillInfo->next;
|
p = FILL_IS_ASC_FILL(pFillInfo) ? &pFillInfo->prev : &pFillInfo->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
SGroupKeys* pKey = taosArrayGet(p->pRowVal, colIdx);
|
SGroupKeys* pKey = taosArrayGet(p->pRowVal, colIdx);
|
||||||
|
@ -258,8 +254,15 @@ static void copyCurrentRowIntoBuf(SFillInfo* pFillInfo, int32_t rowIndex, SRowVa
|
||||||
for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
|
for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
|
||||||
int32_t type = pFillInfo->pFillCol[i].pExpr->pExpr->nodeType;
|
int32_t type = pFillInfo->pFillCol[i].pExpr->pExpr->nodeType;
|
||||||
if ( type == QUERY_NODE_COLUMN || type == QUERY_NODE_OPERATOR || type == QUERY_NODE_FUNCTION) {
|
if ( type == QUERY_NODE_COLUMN || type == QUERY_NODE_OPERATOR || type == QUERY_NODE_FUNCTION) {
|
||||||
|
if (!pFillInfo->pFillCol[i].notFillCol && pFillInfo->type != TSDB_FILL_NEXT) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
int32_t srcSlotId = GET_DEST_SLOT_ID(&pFillInfo->pFillCol[i]);
|
int32_t srcSlotId = GET_DEST_SLOT_ID(&pFillInfo->pFillCol[i]);
|
||||||
|
|
||||||
|
if (srcSlotId == pFillInfo->srcTsSlotId && pFillInfo->type == TSDB_FILL_LINEAR) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
SColumnInfoData* pSrcCol = taosArrayGet(pFillInfo->pSrcBlock->pDataBlock, srcSlotId);
|
SColumnInfoData* pSrcCol = taosArrayGet(pFillInfo->pSrcBlock->pDataBlock, srcSlotId);
|
||||||
|
|
||||||
bool isNull = colDataIsNull_s(pSrcCol, rowIndex);
|
bool isNull = colDataIsNull_s(pSrcCol, rowIndex);
|
||||||
|
@ -288,8 +291,12 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t
|
||||||
int64_t ts = ((int64_t*)pTsCol->pData)[pFillInfo->index];
|
int64_t ts = ((int64_t*)pTsCol->pData)[pFillInfo->index];
|
||||||
|
|
||||||
// set the next value for interpolation
|
// set the next value for interpolation
|
||||||
if ((pFillInfo->currentKey < ts && ascFill) || (pFillInfo->currentKey > ts && !ascFill)) {
|
if (pFillInfo->currentKey < ts && ascFill) {
|
||||||
copyCurrentRowIntoBuf(pFillInfo, pFillInfo->index, &pFillInfo->next);
|
SRowVal* pRVal = pFillInfo->type == TSDB_FILL_NEXT ? &pFillInfo->next : &pFillInfo->prev;
|
||||||
|
copyCurrentRowIntoBuf(pFillInfo, pFillInfo->index, pRVal);
|
||||||
|
} else if (pFillInfo->currentKey > ts && !ascFill) {
|
||||||
|
SRowVal* pRVal = pFillInfo->type == TSDB_FILL_NEXT ? &pFillInfo->prev : &pFillInfo->next;
|
||||||
|
copyCurrentRowIntoBuf(pFillInfo, pFillInfo->index, pRVal);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((pFillInfo->currentKey < ts && ascFill) || (pFillInfo->currentKey > ts && !ascFill)) &&
|
if (((pFillInfo->currentKey < ts && ascFill) || (pFillInfo->currentKey > ts && !ascFill)) &&
|
||||||
|
|
Loading…
Reference in New Issue