From 210625a5e46805965ace80068864037172987319 Mon Sep 17 00:00:00 2001 From: Cary Xu Date: Wed, 16 Feb 2022 16:05:47 +0800 Subject: [PATCH] Feature/td 11463 (#10281) * initial commit * fix commit error * update colId to PRIMARYKEY_TIMESTAMP_COL_ID during commit * update colId to PRIMARYKEY_TIMESTAMP_COL_ID during commit * update colId to PRIMARYKEY_TIMESTAMP_COL_ID during commit * adaption of startIdx for bound cols or disorder cols Co-authored-by: Hongze Cheng --- source/libs/parser/inc/dataBlockMgt.h | 4 ++-- source/libs/parser/src/insertParser.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/source/libs/parser/inc/dataBlockMgt.h b/source/libs/parser/inc/dataBlockMgt.h index f93daa7f93..cbc35240a3 100644 --- a/source/libs/parser/inc/dataBlockMgt.h +++ b/source/libs/parser/inc/dataBlockMgt.h @@ -94,7 +94,7 @@ static FORCE_INLINE void getMemRowAppendInfo(SSchema *pSchema, uint8_t rowType, int32_t idx, int32_t *toffset, int32_t *colIdx) { int32_t schemaIdx = 0; if (IS_DATA_COL_ORDERED(spd)) { - schemaIdx = spd->boundedColumns[idx] - 1; + schemaIdx = spd->boundedColumns[idx] - PRIMARYKEY_TIMESTAMP_COL_ID; if (TD_IS_TP_ROW_T(rowType)) { *toffset = (spd->cols + schemaIdx)->toffset; // the offset of firstPart *colIdx = schemaIdx; @@ -104,7 +104,7 @@ static FORCE_INLINE void getMemRowAppendInfo(SSchema *pSchema, uint8_t rowType, } } else { ASSERT(idx == (spd->colIdxInfo + idx)->boundIdx); - schemaIdx = (spd->colIdxInfo + idx)->schemaColIdx; + schemaIdx = (spd->colIdxInfo + idx)->schemaColIdx - PRIMARYKEY_TIMESTAMP_COL_ID; if (TD_IS_TP_ROW_T(rowType)) { *toffset = (spd->cols + schemaIdx)->toffset; *colIdx = schemaIdx; diff --git a/source/libs/parser/src/insertParser.c b/source/libs/parser/src/insertParser.c index 08fe0852b1..dab52df9b6 100644 --- a/source/libs/parser/src/insertParser.c +++ b/source/libs/parser/src/insertParser.c @@ -322,7 +322,7 @@ static int32_t parseBoundColumns(SInsertParseContext* pCxt, SParsedDataColInfo* } lastColIdx = index; pColList->cols[index].valStat = VAL_STAT_HAS; - pColList->boundedColumns[pColList->numOfBound] = index; + pColList->boundedColumns[pColList->numOfBound] = index + PRIMARYKEY_TIMESTAMP_COL_ID; ++pColList->numOfBound; switch (pSchema[t].type) { case TSDB_DATA_TYPE_BINARY: