tdataformat.h 14.0 KB
Newer Older
H
more  
hzcheng 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
/*
 * Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
 *
 * This program is free software: you can use, redistribute, and/or modify
 * it under the terms of the GNU Affero General Public License, version 3
 * or later ("AGPL"), as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
S
Shengliang Guan 已提交
15

16 17
#ifndef _TD_COMMON_DATA_FORMAT_H_
#define _TD_COMMON_DATA_FORMAT_H_
H
more  
Hongze Cheng 已提交
18

S
TD-4088  
Shengliang Guan 已提交
19
#include "os.h"
H
Hongze Cheng 已提交
20
#include "talgo.h"
H
Hongze Cheng 已提交
21
#include "tarray.h"
H
Hongze Cheng 已提交
22
#include "tencode.h"
H
Haojun Liao 已提交
23
#include "ttypes.h"
H
TD-166  
hzcheng 已提交
24
#include "tutil.h"
H
hzcheng 已提交
25

H
more  
hzcheng 已提交
26 27 28
#ifdef __cplusplus
extern "C" {
#endif
H
hzcheng 已提交
29

H
Hongze Cheng 已提交
30 31 32
typedef struct SSchema       SSchema;
typedef struct STColumn      STColumn;
typedef struct STSchema      STSchema;
H
Hongze Cheng 已提交
33
typedef struct SColVal       SColVal;
H
Hongze Cheng 已提交
34 35
typedef struct STSRow2       STSRow2;
typedef struct STSRowBuilder STSRowBuilder;
H
Hongze Cheng 已提交
36 37
typedef struct STagVal       STagVal;
typedef struct STag          STag;
H
Hongze Cheng 已提交
38 39

// STSchema
H
Hongze Cheng 已提交
40
int32_t tTSchemaCreate(int32_t sver, SSchema *pSchema, int32_t nCols, STSchema **ppTSchema);
H
Hongze Cheng 已提交
41
void    tTSchemaDestroy(STSchema *pTSchema);
H
Hongze Cheng 已提交
42

H
Hongze Cheng 已提交
43
// SColVal
H
Hongze Cheng 已提交
44 45 46
#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)})
H
Hongze Cheng 已提交
47 48

// STSRow2
H
Hongze Cheng 已提交
49 50
int32_t tPutTSRow(uint8_t *p, STSRow2 *pRow);
int32_t tGetTSRow(uint8_t *p, STSRow2 *pRow);
H
Hongze Cheng 已提交
51 52
int32_t tTSRowDup(const STSRow2 *pRow, STSRow2 **ppRow);
void    tTSRowFree(STSRow2 *pRow);
H
Hongze Cheng 已提交
53 54
int32_t tTSRowGet(const STSRow2 *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal);

H
Hongze Cheng 已提交
55
// STSRowBuilder
H
Hongze Cheng 已提交
56
int32_t tTSRowBuilderInit(STSRowBuilder *pBuilder, int32_t sver, int32_t nCols, SSchema *pSchema);
H
Hongze Cheng 已提交
57 58
void    tTSRowBuilderClear(STSRowBuilder *pBuilder);
void    tTSRowBuilderReset(STSRowBuilder *pBuilder);
H
Hongze Cheng 已提交
59
int32_t tTSRowBuilderPut(STSRowBuilder *pBuilder, int32_t cid, uint8_t *pData, uint32_t nData);
H
Hongze Cheng 已提交
60 61
int32_t tTSRowBuilderGetRow(STSRowBuilder *pBuilder, const STSRow2 **ppRow);

C
Cary Xu 已提交
62
// STagVal
C
Cary Xu 已提交
63 64
static FORCE_INLINE void tTagValPush(SArray *pTagArray, void *key, int8_t type, uint8_t *pData, uint32_t nData,
                                     bool isJson);
C
Cary Xu 已提交
65

H
Hongze Cheng 已提交
66
// STag
H
Hongze Cheng 已提交
67
int32_t tTagNew(SArray *pArray, int32_t version, int8_t isJson, STag **ppTag);
H
Hongze Cheng 已提交
68
void    tTagFree(STag *pTag);
C
Cary Xu 已提交
69
bool    tTagGet(const STag *pTag, STagVal *pTagVal);
H
more  
Hongze Cheng 已提交
70
int32_t tEncodeTag(SEncoder *pEncoder, const STag *pTag);
H
Hongze Cheng 已提交
71
int32_t tDecodeTag(SDecoder *pDecoder, STag **ppTag);
C
Cary Xu 已提交
72 73
int32_t tTagToValArray(const STag *pTag, SArray **ppArray);
void    debugPrintSTag(STag *pTag, const char *tag, int32_t ln);
H
Hongze Cheng 已提交
74

H
Hongze Cheng 已提交
75 76 77 78 79 80 81 82 83 84
// STRUCT =================
struct STColumn {
  col_id_t colId;
  int8_t   type;
  int8_t   flags;
  int32_t  bytes;
  int32_t  offset;
};

struct STSchema {
H
Hongze Cheng 已提交
85 86 87 88 89 90
  int32_t  numOfCols;
  int32_t  version;
  int32_t  flen;
  int32_t  vlen;
  int32_t  tlen;
  STColumn columns[];
H
Hongze Cheng 已提交
91 92
};

H
Hongze Cheng 已提交
93 94 95 96
#define TSROW_HAS_NONE ((uint8_t)0x1)
#define TSROW_HAS_NULL ((uint8_t)0x2U)
#define TSROW_HAS_VAL  ((uint8_t)0x4U)
#define TSROW_KV_ROW   ((uint8_t)0x10U)
H
Hongze Cheng 已提交
97
struct STSRow2 {
H
Hongze Cheng 已提交
98 99 100 101 102
  TSKEY    ts;
  uint8_t  flags;
  int32_t  sver;
  uint32_t nData;
  uint8_t *pData;
H
Hongze Cheng 已提交
103 104 105 106
};

struct STSRowBuilder {
  STSchema *pTSchema;
H
Hongze Cheng 已提交
107 108
  int32_t   szBitMap1;
  int32_t   szBitMap2;
H
Hongze Cheng 已提交
109 110 111 112
  int32_t   szKVBuf;
  uint8_t  *pKVBuf;
  int32_t   szTPBuf;
  uint8_t  *pTPBuf;
H
Hongze Cheng 已提交
113 114 115
  int32_t   iCol;
  int32_t   vlenKV;
  int32_t   vlenTP;
H
Hongze Cheng 已提交
116 117 118
  STSRow2   row;
};

H
Hongze Cheng 已提交
119
typedef enum { COL_VAL_NONE = 0, COL_VAL_NULL = 1, COL_VAL_DATA = 2 } EColValT;
H
Hongze Cheng 已提交
120
struct SColVal {
H
Hongze Cheng 已提交
121 122 123
  EColValT type;
  uint32_t nData;
  uint8_t *pData;
H
Hongze Cheng 已提交
124 125
};

H
Hongze Cheng 已提交
126
struct STagVal {
H
Hongze Cheng 已提交
127 128 129 130
  union {
    int16_t cid;
    char   *pKey;
  };
H
Hongze Cheng 已提交
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
  int8_t type;
  union {
    int8_t   i8;
    uint8_t  u8;
    int16_t  i16;
    uint16_t u16;
    int32_t  i32;
    uint32_t u32;
    int64_t  i64;
    uint64_t u64;
    float    f;
    double   d;
    struct {
      uint32_t nData;
      uint8_t *pData;
    };
  };
H
Hongze Cheng 已提交
148 149
};

C
Cary Xu 已提交
150 151 152
static FORCE_INLINE void tTagValPush(SArray *pTagArray, void *key, int8_t type, uint8_t *pData, uint32_t nData,
                                     bool isJson) {
  STagVal tagVal = {0};
C
Cary Xu 已提交
153
  if (isJson) {
C
Cary Xu 已提交
154
    tagVal.pKey = (char *)key;
C
Cary Xu 已提交
155
  } else {
C
Cary Xu 已提交
156
    tagVal.cid = *(int16_t *)key;
C
Cary Xu 已提交
157 158
  }

C
Cary Xu 已提交
159 160 161 162
  tagVal.type = type;
  tagVal.pData = pData;
  tagVal.nData = nData;
  taosArrayPush(pTagArray, &tagVal);
C
Cary Xu 已提交
163 164 165
}

#pragma pack(push, 1)
C
Cary Xu 已提交
166 167
#define TD_TAG_JSON  ((int8_t)0x1)
#define TD_TAG_LARGE ((int8_t)0x2)
C
Cary Xu 已提交
168
struct STag {
C
Cary Xu 已提交
169
  int8_t  flags;
C
Cary Xu 已提交
170 171 172
  int16_t len;
  int16_t nTag;
  int32_t ver;
C
Cary Xu 已提交
173
  int8_t  idx[];
C
Cary Xu 已提交
174 175 176
};
#pragma pack(pop)

H
Hongze Cheng 已提交
177
#if 1  //================================================================================================================================================
C
Cary Xu 已提交
178 179
// Imported since 3.0 and use bitmap to demonstrate None/Null/Norm, while use Null/Norm below 3.0 without of bitmap.
#define TD_SUPPORT_BITMAP
C
Cary Xu 已提交
180
#define TD_SUPPORT_READ2
K
Kaili Xu 已提交
181 182 183
#define TD_SUPPORT_BACK2  // suppport back compatibility of 2.0

#define TASSERT(x) ASSERT(x)
C
Cary Xu 已提交
184

185 186 187 188 189
#define STR_TO_VARSTR(x, str)                     \
  do {                                            \
    VarDataLenT __len = (VarDataLenT)strlen(str); \
    *(VarDataLenT *)(x) = __len;                  \
    memcpy(varDataVal(x), (str), __len);          \
H
Hongze Cheng 已提交
190 191
  } while (0);

H
Hongze Cheng 已提交
192 193 194 195 196 197
#define STR_TO_NET_VARSTR(x, str)                 \
  do {                                            \
    VarDataLenT __len = (VarDataLenT)strlen(str); \
    *(VarDataLenT *)(x) = htons(__len);           \
    memcpy(varDataVal(x), (str), __len);          \
  } while (0);
D
dapan1121 已提交
198

199 200
#define STR_WITH_MAXSIZE_TO_VARSTR(x, str, _maxs)                         \
  do {                                                                    \
H
Hui Li 已提交
201
    char *_e = stpncpy(varDataVal(x), (str), (_maxs)-VARSTR_HEADER_SIZE); \
202
    varDataSetLen(x, (_e - (x)-VARSTR_HEADER_SIZE));                      \
H
Hongze Cheng 已提交
203 204
  } while (0)

205 206 207 208
#define STR_WITH_SIZE_TO_VARSTR(x, str, _size)  \
  do {                                          \
    *(VarDataLenT *)(x) = (VarDataLenT)(_size); \
    memcpy(varDataVal(x), (str), (_size));      \
H
Hongze Cheng 已提交
209
  } while (0);
H
hjxilinx 已提交
210

211 212
// ----------------- TSDB COLUMN DEFINITION

S
Shengliang Guan 已提交
213
#define colType(col)   ((col)->type)
C
Cary Xu 已提交
214
#define colFlags(col)  ((col)->flags)
S
Shengliang Guan 已提交
215 216
#define colColId(col)  ((col)->colId)
#define colBytes(col)  ((col)->bytes)
217 218
#define colOffset(col) ((col)->offset)

S
Shengliang Guan 已提交
219
#define colSetType(col, t)   (colType(col) = (t))
C
Cary Xu 已提交
220
#define colSetFlags(col, f)  (colFlags(col) = (f))
221
#define colSetColId(col, id) (colColId(col) = (id))
S
Shengliang Guan 已提交
222
#define colSetBytes(col, b)  (colBytes(col) = (b))
223 224 225 226
#define colSetOffset(col, o) (colOffset(col) = (o))

// ----------------- TSDB SCHEMA DEFINITION

S
Shengliang Guan 已提交
227 228 229 230 231
#define schemaNCols(s)    ((s)->numOfCols)
#define schemaVersion(s)  ((s)->version)
#define schemaTLen(s)     ((s)->tlen)
#define schemaFLen(s)     ((s)->flen)
#define schemaVLen(s)     ((s)->vlen)
232
#define schemaColAt(s, i) ((s)->columns + i)
wafwerar's avatar
wafwerar 已提交
233
#define tdFreeSchema(s)   taosMemoryFreeClear((s))
234

H
Hongze Cheng 已提交
235
STSchema *tdDupSchema(const STSchema *pSchema);
S
Shengliang Guan 已提交
236 237
int32_t   tdEncodeSchema(void **buf, STSchema *pSchema);
void     *tdDecodeSchema(void *buf, STSchema **pRSchema);
238

S
Shengliang Guan 已提交
239
static FORCE_INLINE int32_t comparColId(const void *key1, const void *key2) {
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
  if (*(int16_t *)key1 > ((STColumn *)key2)->colId) {
    return 1;
  } else if (*(int16_t *)key1 < ((STColumn *)key2)->colId) {
    return -1;
  } else {
    return 0;
  }
}

static FORCE_INLINE STColumn *tdGetColOfID(STSchema *pSchema, int16_t colId) {
  void *ptr = bsearch(&colId, (void *)pSchema->columns, schemaNCols(pSchema), sizeof(STColumn), comparColId);
  if (ptr == NULL) return NULL;
  return (STColumn *)ptr;
}

// ----------------- SCHEMA BUILDER DEFINITION
typedef struct {
C
Cary Xu 已提交
257 258 259 260 261 262 263
  int32_t      tCols;
  int32_t      nCols;
  schema_ver_t version;
  uint16_t     flen;
  int32_t      vlen;
  int32_t      tlen;
  STColumn    *columns;
264 265
} STSchemaBuilder;

C
Cary Xu 已提交
266 267 268 269 270 271 272 273 274 275 276
// use 2 bits for bitmap(default: STSRow/sub block)
#define TD_VTYPE_BITS        2
#define TD_VTYPE_PARTS       4  // PARTITIONS: 1 byte / 2 bits
#define TD_VTYPE_OPTR        3  // OPERATOR: 4 - 1, utilize to get remainder
#define TD_BITMAP_BYTES(cnt) (((cnt) + TD_VTYPE_OPTR) >> 2)

// use 1 bit for bitmap(super block)
#define TD_VTYPE_BITS_I        1
#define TD_VTYPE_PARTS_I       8  // PARTITIONS: 1 byte / 1 bit
#define TD_VTYPE_OPTR_I        7  // OPERATOR: 8 - 1, utilize to get remainder
#define TD_BITMAP_BYTES_I(cnt) (((cnt) + TD_VTYPE_OPTR_I) >> 3)
C
Cary Xu 已提交
277

C
Cary Xu 已提交
278
int32_t   tdInitTSchemaBuilder(STSchemaBuilder *pBuilder, schema_ver_t version);
279
void      tdDestroyTSchemaBuilder(STSchemaBuilder *pBuilder);
C
Cary Xu 已提交
280
void      tdResetTSchemaBuilder(STSchemaBuilder *pBuilder, schema_ver_t version);
C
Cary Xu 已提交
281
int32_t   tdAddColToSchema(STSchemaBuilder *pBuilder, int8_t type, int8_t flags, col_id_t colId, col_bytes_t bytes);
282
STSchema *tdGetSchemaFromBuilder(STSchemaBuilder *pBuilder);
H
Hongze Cheng 已提交
283

H
TD-1548  
Hongze Cheng 已提交
284
// ----------------- Semantic timestamp key definition
C
Cary Xu 已提交
285 286
// typedef uint64_t TKEY;
#define TKEY TSKEY
C
Cary Xu 已提交
287

S
Shengliang Guan 已提交
288 289
#define TKEY_INVALID       UINT64_MAX
#define TKEY_NULL          TKEY_INVALID
C
Cary Xu 已提交
290
#define TKEY_NEGATIVE_FLAG (((TKEY)1) << 63)
S
Shengliang Guan 已提交
291
#define TKEY_VALUE_FILTER  (~(TKEY_NEGATIVE_FLAG))
C
Cary Xu 已提交
292 293

#define TKEY_IS_NEGATIVE(tkey) (((tkey)&TKEY_NEGATIVE_FLAG) != 0)
S
Shengliang Guan 已提交
294
#define TKEY_IS_DELETED(tkey)  (false)
C
Cary Xu 已提交
295

S
Shengliang Guan 已提交
296
#define tdGetTKEY(key)  (key)
C
Cary Xu 已提交
297
#define tdGetKey(tskey) (tskey)
C
Cary Xu 已提交
298 299 300 301 302 303

#define MIN_TS_KEY ((TSKEY)0x8000000000000001)
#define MAX_TS_KEY ((TSKEY)0x7fffffffffffffff)

#define TD_TO_TKEY(key) tdGetTKEY(((key) < MIN_TS_KEY) ? MIN_TS_KEY : (((key) > MAX_TS_KEY) ? MAX_TS_KEY : key))

D
dapan1121 已提交
304 305 306 307 308 309 310 311 312 313 314
static FORCE_INLINE TKEY keyToTkey(TSKEY key) {
  TSKEY lkey = key;
  if (key > MAX_TS_KEY) {
    lkey = MAX_TS_KEY;
  } else if (key < MIN_TS_KEY) {
    lkey = MIN_TS_KEY;
  }

  return tdGetTKEY(lkey);
}

S
Shengliang Guan 已提交
315
static FORCE_INLINE int32_t tkeyComparFn(const void *tkey1, const void *tkey2) {
H
TD-1548  
Hongze Cheng 已提交
316 317 318 319 320 321 322 323 324 325 326
  TSKEY key1 = tdGetKey(*(TKEY *)tkey1);
  TSKEY key2 = tdGetKey(*(TKEY *)tkey2);

  if (key1 < key2) {
    return -1;
  } else if (key1 > key2) {
    return 1;
  } else {
    return 0;
  }
}
H
hzcheng 已提交
327

H
TD-34  
hzcheng 已提交
328
// ----------------- Data column structure
329
// SDataCol arrangement: data => bitmap => dataOffset
H
TD-34  
hzcheng 已提交
330
typedef struct SDataCol {
C
Cary Xu 已提交
331 332 333
  int8_t          type;        // column type
  uint8_t         bitmap : 1;  // 0: no bitmap if all rows are NORM, 1: has bitmap if has NULL/NORM rows
  uint8_t         reserve : 7;
H
TD-166  
hzcheng 已提交
334
  int16_t         colId;      // column ID
S
Shengliang Guan 已提交
335 336 337 338
  int32_t         bytes;      // column data bytes defined
  int32_t         offset;     // data offset in a SDataRow (including the header size)
  int32_t         spaceSize;  // Total space size for this column
  int32_t         len;        // column data length
H
TD-166  
hzcheng 已提交
339
  VarDataOffsetT *dataOff;    // For binary and nchar data, the offset in the data column
S
Shengliang Guan 已提交
340 341
  void           *pData;      // Actual data pointer
  void           *pBitmap;    // Bitmap pointer
L
lichuang 已提交
342
  TSKEY           ts;         // only used in last NULL column
H
TD-34  
hzcheng 已提交
343 344
} SDataCol;

K
kailixu 已提交
345
#define isAllRowsNull(pCol) ((pCol)->len == 0)
K
Kaili Xu 已提交
346
#define isAllRowsNone(pCol) ((pCol)->len == 0)
H
TD-166  
hzcheng 已提交
347 348
static FORCE_INLINE void dataColReset(SDataCol *pDataCol) { pDataCol->len = 0; }

S
Shengliang Guan 已提交
349
int32_t tdAllocMemForCol(SDataCol *pCol, int32_t maxPoints);
350

S
Shengliang Guan 已提交
351 352 353
void    dataColInit(SDataCol *pDataCol, STColumn *pCol, int32_t maxPoints);
int32_t dataColAppendVal(SDataCol *pCol, const void *value, int32_t numOfRows, int32_t maxPoints);
void   *dataColSetOffset(SDataCol *pCol, int32_t nEle);
H
TD-166  
hzcheng 已提交
354

S
Shengliang Guan 已提交
355
bool isNEleNull(SDataCol *pCol, int32_t nEle);
H
TD-166  
hzcheng 已提交
356

H
TD-34  
hzcheng 已提交
357
typedef struct {
C
update  
Cary Xu 已提交
358 359
  col_id_t  maxCols;    // max number of columns
  col_id_t  numOfCols;  // Total number of cols
S
Shengliang Guan 已提交
360 361
  int32_t   maxPoints;  // max number of points
  int32_t   numOfRows;
C
Cary Xu 已提交
362 363
  int32_t   bitmapMode : 1;  // default is 0(2 bits), otherwise 1(1 bit)
  int32_t   sversion : 31;   // TODO: set sversion(not used yet)
H
Hongze Cheng 已提交
364
  SDataCol *cols;
H
TD-34  
hzcheng 已提交
365 366
} SDataCols;

367 368 369
static FORCE_INLINE bool tdDataColsIsBitmapI(SDataCols *pCols) { return pCols->bitmapMode != TSDB_BITMODE_DEFAULT; }
static FORCE_INLINE void tdDataColsSetBitmapI(SDataCols *pCols) { pCols->bitmapMode = TSDB_BITMODE_ONE_BIT; }
static FORCE_INLINE bool tdIsBitmapModeI(int8_t bitmapMode) { return bitmapMode != TSDB_BITMODE_DEFAULT; }
C
Cary Xu 已提交
370

S
Shengliang Guan 已提交
371
#define keyCol(pCols)              (&((pCols)->cols[0]))                    // Key column
C
Cary Xu 已提交
372
#define dataColsTKeyAt(pCols, idx) ((TKEY *)(keyCol(pCols)->pData))[(idx)]  // the idx row of column-wised data
S
Shengliang Guan 已提交
373
#define dataColsKeyAt(pCols, idx)  tdGetKey(dataColsTKeyAt(pCols, idx))
374 375 376 377 378 379 380 381
static FORCE_INLINE TKEY dataColsTKeyFirst(SDataCols *pCols) {
  if (pCols->numOfRows) {
    return dataColsTKeyAt(pCols, 0);
  } else {
    return TKEY_INVALID;
  }
}

S
Shengliang Guan 已提交
382
static FORCE_INLINE TSKEY dataColsKeyAtRow(SDataCols *pCols, int32_t row) {
383
  assert(row < pCols->numOfRows);
384 385 386
  return dataColsKeyAt(pCols, row);
}

387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409
static FORCE_INLINE TSKEY dataColsKeyFirst(SDataCols *pCols) {
  if (pCols->numOfRows) {
    return dataColsKeyAt(pCols, 0);
  } else {
    return TSDB_DATA_TIMESTAMP_NULL;
  }
}

static FORCE_INLINE TKEY dataColsTKeyLast(SDataCols *pCols) {
  if (pCols->numOfRows) {
    return dataColsTKeyAt(pCols, pCols->numOfRows - 1);
  } else {
    return TKEY_INVALID;
  }
}

static FORCE_INLINE TSKEY dataColsKeyLast(SDataCols *pCols) {
  if (pCols->numOfRows) {
    return dataColsKeyAt(pCols, pCols->numOfRows - 1);
  } else {
    return TSDB_DATA_TIMESTAMP_NULL;
  }
}
H
TD-34  
hzcheng 已提交
410

S
Shengliang Guan 已提交
411
SDataCols *tdNewDataCols(int32_t maxCols, int32_t maxRows);
H
TD-34  
hzcheng 已提交
412
void       tdResetDataCols(SDataCols *pCols);
S
Shengliang Guan 已提交
413
int32_t    tdInitDataCols(SDataCols *pCols, STSchema *pSchema);
H
TD-100  
hzcheng 已提交
414
SDataCols *tdDupDataCols(SDataCols *pCols, bool keepData);
H
Hongze Cheng 已提交
415
SDataCols *tdFreeDataCols(SDataCols *pCols);
H
Hongze Cheng 已提交
416 417
int32_t    tdMergeDataCols(SDataCols *target, SDataCols *source, int32_t rowsToMerge, int32_t *pOffset, bool update,
                           TDRowVerT maxVer);
H
more  
Hongze Cheng 已提交
418

H
Hongze Cheng 已提交
419
#endif
420

H
more  
hzcheng 已提交
421 422 423 424
#ifdef __cplusplus
}
#endif

H
Hongze Cheng 已提交
425
#endif /*_TD_COMMON_DATA_FORMAT_H_*/
C
Cary Xu 已提交
426 427 428 429 430 431 432 433 434 435 436 437

// SKVRowBuilder;

// int32_t tdInitKVRowBuilder(SKVRowBuilder *pBuilder);
// void    tdDestroyKVRowBuilder(SKVRowBuilder *pBuilder);
// void    tdResetKVRowBuilder(SKVRowBuilder *pBuilder);
// SKVRow  tdGetKVRowFromBuilder(SKVRowBuilder *pBuilder);

// static FORCE_INLINE int32_t tdAddColToKVRow(SKVRowBuilder *pBuilder, col_id_t colId, const void *value, int32_t tlen)

// #ifdef JSON_TAG_REFACTOR
// TODO: JSON_TAG_TODO