fix: after the last cache is created, modify the schema and query again, resulting in taosd crash
This commit is contained in:
parent
b2247a10cb
commit
bc9eb47e04
|
@ -38,16 +38,17 @@ static int32_t saveOneRow(SArray* pRow, SSDataBlock* pBlock, SCacheRowsReader* p
|
|||
*(int64_t*)p->buf = pColVal->ts;
|
||||
allNullRow = false;
|
||||
} else {
|
||||
int32_t slotId = slotIds[i];
|
||||
SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, slotId);
|
||||
|
||||
int32_t slotId = slotIds[i];
|
||||
// add check for null value, caused by the modification of table schema (new column added).
|
||||
if (pColVal == NULL) {
|
||||
if (slotId >= taosArrayGetSize(pRow)) {
|
||||
p->ts = 0;
|
||||
p->isNull = true;
|
||||
colDataSetNULL(pColInfoData, numOfRows);
|
||||
continue;
|
||||
}
|
||||
|
||||
SLastCol* pColVal = (SLastCol*)taosArrayGet(pRow, slotId);
|
||||
|
||||
p->ts = pColVal->ts;
|
||||
p->isNull = !COL_VAL_IS_VALUE(&pColVal->colVal);
|
||||
allNullRow = p->isNull & allNullRow;
|
||||
|
|
|
@ -2461,6 +2461,9 @@ static int32_t firstLastFunctionMergeImpl(SqlFunctionCtx* pCtx, bool isFirstQuer
|
|||
int32_t numOfElems = 0;
|
||||
|
||||
for (int32_t i = start; i < start + pInput->numOfRows; ++i) {
|
||||
if (colDataIsNull_s(pCol, i)) {
|
||||
continue;
|
||||
}
|
||||
char* data = colDataGetData(pCol, i);
|
||||
SFirstLastRes* pInputInfo = (SFirstLastRes*)varDataVal(data);
|
||||
int32_t code = firstLastTransferInfo(pCtx, pInputInfo, pInfo, isFirstQuery, i);
|
||||
|
|
Loading…
Reference in New Issue