From 18fdb85747064e7d9e71f7ca19f30616c3ac26ad Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Thu, 28 Apr 2022 00:24:14 +0800 Subject: [PATCH] add debug log --- include/common/trow.h | 15 +++++++++++---- source/libs/parser/src/parInsert.c | 19 ++++++++++++++++++- 2 files changed, 29 insertions(+), 5 deletions(-) diff --git a/include/common/trow.h b/include/common/trow.h index 11febdc975..3633870f05 100644 --- a/include/common/trow.h +++ b/include/common/trow.h @@ -678,7 +678,7 @@ static int32_t tdSRowResetBuf(SRowBuilder *pBuilder, void *pBuf) { case TD_ROW_KV: #ifdef TD_SUPPORT_BITMAP pBuilder->pBitmap = tdGetBitmapAddrKv(pBuilder->pBuf, pBuilder->nBoundCols); - memset(pBuilder->pBitmap, TD_VTYPE_NONE_BYTE_II, pBuilder->nBitmaps); + memset(pBuilder->pBitmap, TD_VTYPE_NONE_BYTE_II, pBuilder->nBoundBitmaps); #endif len = TD_ROW_HEAD_LEN + TD_ROW_NCOLS_LEN + (pBuilder->nBoundCols - 1) * sizeof(SKvRowIdx) + pBuilder->nBoundBitmaps; // add @@ -1102,7 +1102,7 @@ static FORCE_INLINE bool tdGetKvRowValOfColEx(STSRowIter *pIter, col_id_t colId, STSRow *pRow = pIter->pRow; SKvRowIdx *pKvIdx = NULL; bool colFound = false; - col_id_t kvNCols = tdRowGetNCols(pRow); + col_id_t kvNCols = tdRowGetNCols(pRow) - 1; while (*nIdx < kvNCols) { pKvIdx = (SKvRowIdx *)POINTER_SHIFT(TD_ROW_COL_IDX(pRow), *nIdx * sizeof(SKvRowIdx)); if (pKvIdx->colId == colId) { @@ -1118,7 +1118,14 @@ static FORCE_INLINE bool tdGetKvRowValOfColEx(STSRowIter *pIter, col_id_t colId, } } - if (!colFound) return false; + if (!colFound) { + if (colId <= pIter->maxColId) { + pVal->valType = TD_VTYPE_NONE; + return true; + } else { + return false; + } + } #ifdef TD_SUPPORT_BITMAP int16_t colIdx = -1; @@ -1369,7 +1376,7 @@ static void tdSRowPrint(STSRow *row, STSchema *pSchema) { printf(">>>"); for (int i = 0; i < pSchema->numOfCols; ++i) { STColumn *stCol = pSchema->columns + i; - SCellVal sVal = { 255, NULL}; + SCellVal sVal = {.valType = 255, .val = NULL}; if (!tdSTSRowIterNext(&iter, stCol->colId, stCol->type, &sVal)) { break; } diff --git a/source/libs/parser/src/parInsert.c b/source/libs/parser/src/parInsert.c index d09353c234..29f577ca6b 100644 --- a/source/libs/parser/src/parInsert.c +++ b/source/libs/parser/src/parInsert.c @@ -936,6 +936,11 @@ static int parseOneRow(SInsertParseContext* pCxt, STableDataBlocks* pDataBlocks, } *gotRow = true; +#ifdef TD_DEBUG_PRINT_ROW + STSchema* pSTSchema = tdGetSTSChemaFromSSChema(&schema, spd->numOfCols); + tdSRowPrint(row, pSTSchema); + taosMemoryFree(pSTSchema); +#endif } // *len = pBuilder->extendedRowSize; @@ -1358,7 +1363,6 @@ int32_t qBindStmtColsValue(void *pBlock, TAOS_MULTI_BIND *bind, char *msgBuf, in checkTimestamp(pDataBlock, (const char*)&tsKey); } } - // set the null value for the columns that do not assign values if ((spd->numOfBound < spd->numOfCols) && TD_IS_TP_ROW(row)) { for (int32_t i = 0; i < spd->numOfCols; ++i) { @@ -1368,6 +1372,11 @@ int32_t qBindStmtColsValue(void *pBlock, TAOS_MULTI_BIND *bind, char *msgBuf, in } } } +#ifdef TD_DEBUG_PRINT_ROW + STSchema* pSTSchema = tdGetSTSChemaFromSSChema(&pSchema, spd->numOfCols); + tdSRowPrint(row, pSTSchema); + taosMemoryFree(pSTSchema); +#endif pDataBlock->size += extendedRowSize; } @@ -1446,6 +1455,14 @@ int32_t qBindStmtSingleColValue(void *pBlock, TAOS_MULTI_BIND *bind, char *msgBu } } } + +#ifdef TD_DEBUG_PRINT_ROW + if(rowEnd) { + STSchema* pSTSchema = tdGetSTSChemaFromSSChema(&pSchema, spd->numOfCols); + tdSRowPrint(row, pSTSchema); + taosMemoryFree(pSTSchema); + } +#endif } if (rowEnd) { -- GitLab