diff --git a/src/client/inc/tsclient.h b/src/client/inc/tsclient.h index 072db868d023d432647cf7f40e4621e215cddb94..c23ca2bc98b9790842b0b2a0a910aae5ffe57817 100644 --- a/src/client/inc/tsclient.h +++ b/src/client/inc/tsclient.h @@ -111,6 +111,8 @@ typedef struct SParsedDataColInfo { int8_t orderStatus; // bounded columns: } SParsedDataColInfo; +#define IS_DATA_COL_ORDERED(s) (((s)->orderStatus) == (int8_t)ORDER_STATUS_ORDERED) + typedef struct { SSchema * pSchema; int16_t sversion; diff --git a/src/client/src/tscParseInsert.c b/src/client/src/tscParseInsert.c index edf242174668b5d7f2486ddbd7f2229227c2a7c5..5d3f41acd3dd3aeab02823d85a2d7bf4a9a930ce 100644 --- a/src/client/src/tscParseInsert.c +++ b/src/client/src/tscParseInsert.c @@ -867,7 +867,7 @@ int tsParseOneRow(char **str, STableDataBlocks *pDataBlocks, int16_t timePrec, i TDRowLenT kvRowColLen = 0; TDRowLenT colValAppended = 0; - if (spd->orderStatus == ORDER_STATUS_DISORDERED) { + if (!IS_DATA_COL_ORDERED(spd)) { ASSERT(spd->colIdxInfo != NULL); if(!isPrimaryKey) { kvStart = POINTER_SHIFT(kvPrimaryKeyStart, spd->colIdxInfo[i].finalIdx * PAYLOAD_COL_HEAD_LEN); @@ -1020,7 +1020,7 @@ int32_t tsParseValues(char **str, STableDataBlocks *pDataBlock, int maxRows, SIn void tscSetBoundColumnInfo(SParsedDataColInfo *pColInfo, SSchema *pSchema, int32_t numOfCols) { pColInfo->numOfCols = numOfCols; pColInfo->numOfBound = numOfCols; - pColInfo->orderStatus = ORDER_STATUS_UNKNOWN; + pColInfo->orderStatus = ORDER_STATUS_ORDERED; pColInfo->boundedColumns = calloc(pColInfo->numOfCols, sizeof(int32_t)); pColInfo->cols = calloc(pColInfo->numOfCols, sizeof(SBoundColumn)); pColInfo->colIdxInfo = NULL; diff --git a/src/client/src/tscPrepare.c b/src/client/src/tscPrepare.c index 68fa2454d1c5108c5a2d3233b528017468a71d0b..3739fbaca51314b0d528221596d424c5cf2a03e0 100644 --- a/src/client/src/tscPrepare.c +++ b/src/client/src/tscPrepare.c @@ -370,7 +370,7 @@ static int refactorPayload(STableDataBlocks* pBlock, int32_t rowNum) { bool isPrimaryKey = (colIndex == PRIMARYKEY_TIMESTAMP_COL_INDEX); // the primary key locates in 1st column - if (spd->orderStatus == ORDER_STATUS_DISORDERED) { + if (!IS_DATA_COL_ORDERED(spd)) { ASSERT(spd->colIdxInfo != NULL); if (!isPrimaryKey) { kvStart = POINTER_SHIFT(kvPrimaryKeyStart, spd->colIdxInfo[i].finalIdx * PAYLOAD_COL_HEAD_LEN); @@ -406,7 +406,7 @@ static int refactorPayload(STableDataBlocks* pBlock, int32_t rowNum) { kvRowLen += TYPE_BYTES[pSchema->type]; } - if (spd->orderStatus == ORDER_STATUS_ORDERED) { + if (IS_DATA_COL_ORDERED(spd)) { kvStart += PAYLOAD_COL_HEAD_LEN; // move to next column } }