From d6f02761a02e0a8c430919500104c313c8bbefec Mon Sep 17 00:00:00 2001 From: Hongze Cheng Date: Tue, 31 May 2022 03:08:29 +0000 Subject: [PATCH] more refact --- include/common/tdataformat.h | 19 ++++++++++++------- source/common/src/tdataformat.c | 12 +++++++++++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/include/common/tdataformat.h b/include/common/tdataformat.h index 986ef5edb9..ed3a911c13 100644 --- a/include/common/tdataformat.h +++ b/include/common/tdataformat.h @@ -42,11 +42,13 @@ int32_t tTSchemaCreate(int32_t sver, SSchema *pSchema, int32_t nCols, STSchema * void tTSchemaDestroy(STSchema *pTSchema); // SColVal -#define ColValNONE ((SColVal){.type = COL_VAL_NONE, .nData = 0, .pData = NULL}) -#define ColValNULL ((SColVal){.type = COL_VAL_NULL, .nData = 0, .pData = NULL}) -#define ColValDATA(nData, pData) ((SColVal){.type = COL_VAL_DATA, .nData = (nData), .pData = (pData)}) +// #define ColValNONE ((SColVal){.type = COL_VAL_NONE, .nData = 0, .pData = NULL}) +// #define ColValNULL ((SColVal){.type = COL_VAL_NULL, .nData = 0, .pData = NULL}) +// #define ColValDATA(nData, pData) ((SColVal){.type = COL_VAL_DATA, .nData = (nData), .pData = (pData)}) // STSRow2 +int32_t tTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow2 **ppRow); + int32_t tPutTSRow(uint8_t *p, STSRow2 *pRow); int32_t tGetTSRow(uint8_t *p, STSRow2 *pRow); int32_t tTSRowDup(const STSRow2 *pRow, STSRow2 **ppRow); @@ -54,11 +56,13 @@ void tTSRowFree(STSRow2 *pRow); int32_t tTSRowGet(const STSRow2 *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal); // STSRowBuilder +#if 0 int32_t tTSRowBuilderInit(STSRowBuilder *pBuilder, int32_t sver, int32_t nCols, SSchema *pSchema); void tTSRowBuilderClear(STSRowBuilder *pBuilder); void tTSRowBuilderReset(STSRowBuilder *pBuilder); int32_t tTSRowBuilderPut(STSRowBuilder *pBuilder, int32_t cid, uint8_t *pData, uint32_t nData); int32_t tTSRowBuilderGetRow(STSRowBuilder *pBuilder, const STSRow2 **ppRow); +#endif // STagVal static FORCE_INLINE void tTagValPush(SArray *pTagArray, void *key, int8_t type, uint8_t *pData, uint32_t nData, @@ -137,11 +141,12 @@ struct SValue { }; }; -typedef enum { COL_VAL_NONE = 0, COL_VAL_NULL = 1, COL_VAL_DATA = 2 } EColValT; struct SColVal { - EColValT type; - uint32_t nData; - uint8_t *pData; + int8_t isNone; + int8_t isNull; + int8_t type; + int16_t cid; + SValue value; }; struct STagVal { diff --git a/source/common/src/tdataformat.c b/source/common/src/tdataformat.c index c57de4e2fc..653381925c 100644 --- a/source/common/src/tdataformat.c +++ b/source/common/src/tdataformat.c @@ -146,7 +146,13 @@ static int32_t tGetSValue(uint8_t *p, SValue *pValue, int8_t type) { return n; } -// STSRow2 +// STSRow2 ======================================================================== +int32_t tTSRowNew(SArray *pArray, STSchema *pTSchema, STSRow2 **ppRow) { + int32_t code = 0; + // TODO + return code; +} + int32_t tPutTSRow(uint8_t *p, STSRow2 *pRow) { int32_t n = 0; @@ -215,6 +221,7 @@ void tTSRowFree(STSRow2 *pRow) { } int32_t tTSRowGet(const STSRow2 *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) { +#if 0 uint32_t n; uint8_t *p; uint8_t v; @@ -310,6 +317,7 @@ int32_t tTSRowGet(const STSRow2 *pRow, STSchema *pTSchema, int32_t iCol, SColVal } } +#endif return 0; } @@ -354,6 +362,7 @@ void tTSchemaDestroy(STSchema *pTSchema) { } // STSRowBuilder +#if 0 int32_t tTSRowBuilderInit(STSRowBuilder *pBuilder, int32_t sver, int32_t nCols, SSchema *pSchema) { if (tTSchemaCreate(sver, pSchema, nCols, &pBuilder->pTSchema) < 0) return -1; @@ -612,6 +621,7 @@ int32_t tTSRowBuilderGetRow(STSRowBuilder *pBuilder, const STSRow2 **ppRow) { return 0; } +#endif static int tTagValCmprFn(const void *p1, const void *p2) { if (((STagVal *)p1)->cid < ((STagVal *)p2)->cid) {