fix(query): fix invalid tag fill and clear nullbitmp
This commit is contained in:
parent
1faf616f1d
commit
83782fb27b
|
@ -41,9 +41,9 @@ typedef struct SBlockOrderInfo {
|
|||
BMCharPos(bm_, r_) |= (1u << (7u - BitPos(r_))); \
|
||||
} while (0)
|
||||
|
||||
#define colDataClearNull_f(bm_, r_) \
|
||||
do { \
|
||||
BMCharPos(bm_, r_) &= ~(1u << (7u - BitPos(r_))); \
|
||||
#define colDataClearNull_f(bm_, r_) \
|
||||
do { \
|
||||
BMCharPos(bm_, r_) &= ((char)(~(1u << (7u - BitPos(r_))))); \
|
||||
} while (0)
|
||||
|
||||
#define colDataIsNull_var(pColumnInfoData, row) (pColumnInfoData->varmeta.offset[row] == -1)
|
||||
|
|
|
@ -1679,15 +1679,15 @@ static void colDataKeepFirstNRows(SColumnInfoData* pColInfoData, size_t n, size_
|
|||
pColInfoData->varmeta.length = colDataMoveVarData(pColInfoData, 0, n);
|
||||
memset(&pColInfoData->varmeta.offset[n], 0, total - n);
|
||||
} else { // reset the bitmap value
|
||||
int32_t stopIndex = BitmapLen(n) * 8;
|
||||
for(int32_t i = n + 1; i < stopIndex; ++i) {
|
||||
/*int32_t stopIndex = BitmapLen(n) * 8;
|
||||
for(int32_t i = n; i < stopIndex; ++i) {
|
||||
colDataClearNull_f(pColInfoData->nullbitmap, i);
|
||||
}
|
||||
|
||||
int32_t remain = BitmapLen(total) - BitmapLen(n);
|
||||
if (remain > 0) {
|
||||
memset(pColInfoData->nullbitmap, 0, remain);
|
||||
}
|
||||
memset(pColInfoData->nullbitmap+BitmapLen(n), 0, remain);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -60,8 +60,18 @@ static void setNullRow(SSDataBlock* pBlock, SFillInfo* pFillInfo, int32_t rowInd
|
|||
if (pCol->notFillCol) {
|
||||
bool filled = fillIfWindowPseudoColumn(pFillInfo, pCol, pDstColInfo, rowIndex);
|
||||
if (!filled) {
|
||||
SArray* p = FILL_IS_ASC_FILL(pFillInfo) ? pFillInfo->prev.pRowVal : pFillInfo->next.pRowVal;
|
||||
SGroupKeys* pKey = taosArrayGet(p, i);
|
||||
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, i);
|
||||
doSetVal(pDstColInfo, rowIndex, pKey);
|
||||
}
|
||||
} else {
|
||||
|
@ -261,7 +271,10 @@ static void initBeforeAfterDataBuf(SFillInfo* pFillInfo) {
|
|||
|
||||
static void saveColData(SArray* rowBuf, int32_t columnIndex, const char* src, bool isNull);
|
||||
|
||||
static void copyCurrentRowIntoBuf(SFillInfo* pFillInfo, int32_t rowIndex, SArray* pRow) {
|
||||
static void copyCurrentRowIntoBuf(SFillInfo* pFillInfo, int32_t rowIndex, SRowVal* pRowVal) {
|
||||
SColumnInfoData* pTsCol = taosArrayGet(pFillInfo->pSrcBlock->pDataBlock, pFillInfo->srcTsSlotId);
|
||||
pRowVal->key = ((int64_t*)pTsCol->pData)[rowIndex];
|
||||
|
||||
for (int32_t i = 0; i < pFillInfo->numOfCols; ++i) {
|
||||
int32_t type = pFillInfo->pFillCol[i].pExpr->pExpr->nodeType;
|
||||
if (type == QUERY_NODE_COLUMN || type == QUERY_NODE_OPERATOR || type == QUERY_NODE_FUNCTION) {
|
||||
|
@ -272,7 +285,7 @@ static void copyCurrentRowIntoBuf(SFillInfo* pFillInfo, int32_t rowIndex, SArray
|
|||
bool isNull = colDataIsNull_s(pSrcCol, rowIndex);
|
||||
char* p = colDataGetData(pSrcCol, rowIndex);
|
||||
|
||||
saveColData(pRow, i, p, isNull);
|
||||
saveColData(pRowVal->pRowVal, i, p, isNull);
|
||||
} else {
|
||||
ASSERT(0);
|
||||
}
|
||||
|
@ -296,7 +309,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t
|
|||
|
||||
// set the next value for interpolation
|
||||
if ((pFillInfo->currentKey < ts && ascFill) || (pFillInfo->currentKey > ts && !ascFill)) {
|
||||
copyCurrentRowIntoBuf(pFillInfo, pFillInfo->index, pFillInfo->next.pRowVal);
|
||||
copyCurrentRowIntoBuf(pFillInfo, pFillInfo->index, &pFillInfo->next);
|
||||
}
|
||||
|
||||
if (((pFillInfo->currentKey < ts && ascFill) || (pFillInfo->currentKey > ts && !ascFill)) &&
|
||||
|
@ -318,7 +331,7 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t
|
|||
|
||||
if (pFillInfo->type == TSDB_FILL_NEXT && (pFillInfo->index + 1) < pFillInfo->numOfRows) {
|
||||
int32_t nextRowIndex = pFillInfo->index + 1;
|
||||
copyCurrentRowIntoBuf(pFillInfo, nextRowIndex, pFillInfo->next.pRowVal);
|
||||
copyCurrentRowIntoBuf(pFillInfo, nextRowIndex, &pFillInfo->next);
|
||||
}
|
||||
|
||||
// copy rows to dst buffer
|
||||
|
@ -334,6 +347,9 @@ static int32_t fillResultImpl(SFillInfo* pFillInfo, SSDataBlock* pBlock, int32_t
|
|||
if (!colDataIsNull_s(pSrc, pFillInfo->index)) {
|
||||
colDataAppend(pDst, index, src, false);
|
||||
saveColData(pFillInfo->prev.pRowVal, i, src, false);
|
||||
if (pFillInfo->srcTsSlotId == dstSlotId) {
|
||||
pFillInfo->prev.key = *(int64_t*)src;
|
||||
}
|
||||
} else { // the value is null
|
||||
if (pDst->info.type == TSDB_DATA_TYPE_TIMESTAMP) {
|
||||
colDataAppend(pDst, index, (const char*)&pFillInfo->currentKey, false);
|
||||
|
|
|
@ -70,10 +70,10 @@ sql select _wstart, t1,t1,count(*),t1,t1 from lr_stb0 where ts>'2018-09-24 00:00
|
|||
if $row != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data01 != NULL then
|
||||
if $data01 != 8 then
|
||||
return -1
|
||||
endi
|
||||
if $data02 != NULL then
|
||||
if $data02 != 8 then
|
||||
return -1
|
||||
endi
|
||||
if $data03 != NULL then
|
||||
|
|
|
@ -121,12 +121,13 @@ if $data01 != 152.420471066 then
|
|||
return -1
|
||||
endi
|
||||
|
||||
sql select udf2(f2) from udf.t2 group by 1-udf1(f1);
|
||||
sql select udf2(f2) from udf.t2 group by 1-udf1(f1) order by 1-udf1(f1)
|
||||
print $rows , $data00 , $data10
|
||||
if $rows != 2 then
|
||||
return -1
|
||||
endi
|
||||
if $data00 != 2.000000000 then
|
||||
print expect 2.000000000 , actual: $data00
|
||||
return -1
|
||||
endi
|
||||
if $data10 != 12.083045974 then
|
||||
|
|
Loading…
Reference in New Issue