more code
This commit is contained in:
parent
81d6a1479d
commit
a8f95f53b7
|
@ -100,10 +100,10 @@ const static uint8_t BIT2_MAP[4] = {0b11111100, 0b11110011, 0b11001111, 0b001111
|
|||
typedef struct {
|
||||
int8_t cmprAlg; // filled by caller
|
||||
int8_t type;
|
||||
int32_t originalDataSize;
|
||||
int32_t compressedDataSize;
|
||||
int32_t originalOffsetSize;
|
||||
int32_t compressedOffsetSize;
|
||||
int32_t dataOriginalSize;
|
||||
int32_t dataCompressedSize;
|
||||
int32_t offsetOriginalSize;
|
||||
int32_t offsetCompressedSize;
|
||||
} SValueColumnCompressInfo;
|
||||
|
||||
int32_t tValueColumnInit(SValueColumn *valCol);
|
||||
|
@ -176,10 +176,9 @@ uint8_t tColDataGetBitValue(const SColData *pColData, int32_t iVal);
|
|||
int32_t tColDataCopy(SColData *pColDataFrom, SColData *pColData, xMallocFn xMalloc, void *arg);
|
||||
extern void (*tColDataCalcSMA[])(SColData *pColData, int64_t *sum, int64_t *max, int64_t *min, int16_t *numOfNull);
|
||||
|
||||
int32_t tColDataCompress(SColData *colData, SColDataCompressInfo *info, void *output, int32_t outputSize,
|
||||
SBuffer *buffer);
|
||||
int32_t tColDataDecompress(void *input, int32_t inputSize, const SColDataCompressInfo *info, SColData *colData,
|
||||
SBuffer *helperBuffer);
|
||||
int32_t tColDataCompress(SColData *colData, SColDataCompressInfo *info, SBuffer *output, SBuffer *assist);
|
||||
int32_t tColDataDecompress(void *input, int32_t inputSize, SColDataCompressInfo *info, SColData *colData,
|
||||
SBuffer *assist);
|
||||
|
||||
// for stmt bind
|
||||
int32_t tColDataAddValueByBind(SColData *pColData, TAOS_MULTI_BIND *pBind, int32_t buffMaxLen);
|
||||
|
@ -356,8 +355,7 @@ int32_t tDecompressData(void *input, // input
|
|||
SBuffer *buffer // assistant buffer provided by caller, can be NULL
|
||||
);
|
||||
int32_t tCompressDataToBuffer(void *input, int32_t inputSize, SCompressInfo *info, SBuffer *output, SBuffer *assist);
|
||||
int32_t tDecompressDataToBuffer(void *input, int32_t inputSize, const SCompressInfo *info, SBuffer *output,
|
||||
SBuffer *assist);
|
||||
int32_t tDecompressDataToBuffer(void *input, int32_t inputSize, SCompressInfo *info, SBuffer *output, SBuffer *assist);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -468,217 +468,272 @@ static FORCE_INLINE void* tDecoderMalloc(SDecoder* pCoder, int32_t size) {
|
|||
}
|
||||
|
||||
// ===========================================
|
||||
#define TPUT(TYPE, BUF, VAL, FORWARD) \
|
||||
do { \
|
||||
if (BUF) { \
|
||||
if (FORWARD) { \
|
||||
*(TYPE*)(BUF) = (VAL); \
|
||||
} else { \
|
||||
*(TYPE*)((BUF) - sizeof(TYPE)) = (VAL); \
|
||||
} \
|
||||
} \
|
||||
return sizeof(TYPE); \
|
||||
} while (0)
|
||||
|
||||
#define TGET(TYPE, BUF, VAL, FORWARD) \
|
||||
do { \
|
||||
if (FORWARD) { \
|
||||
*(TYPE*)(VAL) = *(TYPE*)(BUF); \
|
||||
} else { \
|
||||
*(TYPE*)(VAL) = *(TYPE*)((BUF) - sizeof(TYPE)); \
|
||||
} \
|
||||
return sizeof(TYPE); \
|
||||
} while (0)
|
||||
|
||||
#define TPUTV(BUF, VAL, FORWARD) \
|
||||
do { \
|
||||
int32_t n = 0; \
|
||||
for (;;) { \
|
||||
if ((VAL) < 0x80) { \
|
||||
if (BUF) { \
|
||||
if (FORWARD) { \
|
||||
(BUF)[n] = (VAL); \
|
||||
} else { \
|
||||
(BUF)[-(n + 1)] = (VAL); \
|
||||
} \
|
||||
} \
|
||||
n++; \
|
||||
break; \
|
||||
} else { \
|
||||
if (BUF) { \
|
||||
if (FORWARD) { \
|
||||
(BUF)[n] = ((VAL) & 0x7f) | 0x80; \
|
||||
} else { \
|
||||
(BUF)[-(n + 1)] = ((VAL) & 0x7f) | 0x80; \
|
||||
} \
|
||||
} \
|
||||
n++; \
|
||||
(VAL) >>= 7; \
|
||||
} \
|
||||
} \
|
||||
return n; \
|
||||
} while (0)
|
||||
|
||||
#define TGETV(BUF, VAL, FORWARD) \
|
||||
do { \
|
||||
int32_t n = 0; \
|
||||
if (VAL) { \
|
||||
*(VAL) = 0; \
|
||||
} \
|
||||
for (;;) { \
|
||||
if (FORWARD) { \
|
||||
if (VAL) { \
|
||||
(*(VAL)) |= ((BUF)[n] & 0x7f) << (7 * n); \
|
||||
} \
|
||||
if ((BUF)[n++] < 0x80) break; \
|
||||
} else { \
|
||||
if (VAL) { \
|
||||
(*(VAL)) |= ((BUF)[-(n + 1)] & 0x7f) << (7 * n); \
|
||||
} \
|
||||
if ((BUF)[-(n++)] < 0x80) break; \
|
||||
} \
|
||||
} \
|
||||
return n; \
|
||||
#define tPutV(p, v) \
|
||||
do { \
|
||||
int32_t n = 0; \
|
||||
for (;;) { \
|
||||
if (v <= 0x7f) { \
|
||||
if (p) p[n] = v; \
|
||||
n++; \
|
||||
break; \
|
||||
} \
|
||||
if (p) p[n] = (v & 0x7f) | 0x80; \
|
||||
n++; \
|
||||
v >>= 7; \
|
||||
} \
|
||||
return n; \
|
||||
} while (0)
|
||||
|
||||
// PUT
|
||||
static FORCE_INLINE int32_t tPutU8(uint8_t* p, uint8_t v, bool forward) { TPUT(uint8_t, p, v, forward); }
|
||||
static FORCE_INLINE int32_t tPutI8(uint8_t* p, int8_t v, bool forward) { TPUT(int8_t, p, v, forward); }
|
||||
static FORCE_INLINE int32_t tPutU16(uint8_t* p, uint16_t v, bool forward) { TPUT(uint16_t, p, v, forward); }
|
||||
static FORCE_INLINE int32_t tPutI16(uint8_t* p, int16_t v, bool forward) { TPUT(int16_t, p, v, forward); }
|
||||
static FORCE_INLINE int32_t tPutU32(uint8_t* p, uint32_t v, bool forward) { TPUT(uint32_t, p, v, forward); }
|
||||
static FORCE_INLINE int32_t tPutI32(uint8_t* p, int32_t v, bool forward) { TPUT(int32_t, p, v, forward); }
|
||||
static FORCE_INLINE int32_t tPutU64(uint8_t* p, uint64_t v, bool forward) { TPUT(uint64_t, p, v, forward); }
|
||||
static FORCE_INLINE int32_t tPutI64(uint8_t* p, int64_t v, bool forward) { TPUT(int64_t, p, v, forward); }
|
||||
static FORCE_INLINE int32_t tPutU8(uint8_t* p, uint8_t v) {
|
||||
if (p) ((uint8_t*)p)[0] = v;
|
||||
return sizeof(uint8_t);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tPutFloat(uint8_t* p, float f, bool forward) {
|
||||
static FORCE_INLINE int32_t tPutI8(uint8_t* p, int8_t v) {
|
||||
if (p) ((int8_t*)p)[0] = v;
|
||||
return sizeof(int8_t);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tPutU16(uint8_t* p, uint16_t v) {
|
||||
if (p) ((uint16_t*)p)[0] = v;
|
||||
return sizeof(uint16_t);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tPutI16(uint8_t* p, int16_t v) {
|
||||
if (p) ((int16_t*)p)[0] = v;
|
||||
return sizeof(int16_t);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tPutU32(uint8_t* p, uint32_t v) {
|
||||
if (p) ((uint32_t*)p)[0] = v;
|
||||
return sizeof(uint32_t);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tPutI32(uint8_t* p, int32_t v) {
|
||||
if (p) ((int32_t*)p)[0] = v;
|
||||
return sizeof(int32_t);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tPutU64(uint8_t* p, uint64_t v) {
|
||||
if (p) ((uint64_t*)p)[0] = v;
|
||||
return sizeof(uint64_t);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tPutI64(uint8_t* p, int64_t v) {
|
||||
if (p) ((int64_t*)p)[0] = v;
|
||||
return sizeof(int64_t);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tPutFloat(uint8_t* p, float f) {
|
||||
union {
|
||||
uint32_t ui;
|
||||
float f;
|
||||
} v = {.f = f};
|
||||
return tPutU32(p, v.ui, forward);
|
||||
} v;
|
||||
v.f = f;
|
||||
|
||||
return tPutU32(p, v.ui);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tPutDouble(uint8_t* p, double d, bool forward) {
|
||||
static FORCE_INLINE int32_t tPutDouble(uint8_t* p, double d) {
|
||||
union {
|
||||
uint64_t ui;
|
||||
double d;
|
||||
} v = {.d = d};
|
||||
return tPutU64(p, v.ui, forward);
|
||||
} v;
|
||||
v.d = d;
|
||||
|
||||
return tPutU64(p, v.ui);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tPutU16v(uint8_t* p, uint16_t v, bool forward) { TPUTV(p, v, forward); }
|
||||
static FORCE_INLINE int32_t tPutI16v(uint8_t* p, int16_t v, bool forward) {
|
||||
return tPutU16v(p, ZIGZAGE(int16_t, v), forward);
|
||||
}
|
||||
static FORCE_INLINE int32_t tPutU32v(uint8_t* p, uint32_t v, bool forward) { TPUTV(p, v, forward); }
|
||||
static FORCE_INLINE int32_t tPutI32v(uint8_t* p, int32_t v, bool forward) {
|
||||
return tPutU32v(p, ZIGZAGE(int32_t, v), forward);
|
||||
}
|
||||
static FORCE_INLINE int32_t tPutU64v(uint8_t* p, uint64_t v, bool forward) { TPUTV(p, v, forward); }
|
||||
static FORCE_INLINE int32_t tPutI64v(uint8_t* p, int64_t v, bool forward) {
|
||||
return tPutU64v(p, ZIGZAGE(int64_t, v), forward);
|
||||
}
|
||||
static FORCE_INLINE int32_t tPutU16v(uint8_t* p, uint16_t v) { tPutV(p, v); }
|
||||
|
||||
static FORCE_INLINE int32_t tPutI16v(uint8_t* p, int16_t v) { return tPutU16v(p, ZIGZAGE(int16_t, v)); }
|
||||
|
||||
static FORCE_INLINE int32_t tPutU32v(uint8_t* p, uint32_t v) { tPutV(p, v); }
|
||||
|
||||
static FORCE_INLINE int32_t tPutI32v(uint8_t* p, int32_t v) { return tPutU32v(p, ZIGZAGE(int32_t, v)); }
|
||||
|
||||
static FORCE_INLINE int32_t tPutU64v(uint8_t* p, uint64_t v) { tPutV(p, v); }
|
||||
|
||||
static FORCE_INLINE int32_t tPutI64v(uint8_t* p, int64_t v) { return tPutU64v(p, ZIGZAGE(int64_t, v)); }
|
||||
|
||||
// GET
|
||||
static FORCE_INLINE int32_t tGetU8(uint8_t* p, uint8_t* v, bool forward) { TGET(uint8_t, p, v, forward); }
|
||||
static FORCE_INLINE int32_t tGetI8(uint8_t* p, int8_t* v, bool forward) { TGET(int8_t, p, v, forward); }
|
||||
static FORCE_INLINE int32_t tGetU16(uint8_t* p, uint16_t* v, bool forward) { TGET(uint16_t, p, v, forward); }
|
||||
static FORCE_INLINE int32_t tGetI16(uint8_t* p, int16_t* v, bool forward) { TGET(int16_t, p, v, forward); }
|
||||
static FORCE_INLINE int32_t tGetU32(uint8_t* p, uint32_t* v, bool forward) { TGET(uint32_t, p, v, forward); }
|
||||
static FORCE_INLINE int32_t tGetI32(uint8_t* p, int32_t* v, bool forward) { TGET(int32_t, p, v, forward); }
|
||||
static FORCE_INLINE int32_t tGetU64(uint8_t* p, uint64_t* v, bool forward) { TGET(uint64_t, p, v, forward); }
|
||||
static FORCE_INLINE int32_t tGetI64(uint8_t* p, int64_t* v, bool forward) { TGET(int64_t, p, v, forward); }
|
||||
static FORCE_INLINE int32_t tGetU16v(uint8_t* p, uint16_t* v, bool forward) { TGETV(p, v, forward); }
|
||||
static FORCE_INLINE int32_t tGetI16v(uint8_t* p, int16_t* v, bool forward) {
|
||||
static FORCE_INLINE int32_t tGetU8(uint8_t* p, uint8_t* v) {
|
||||
if (v) *v = ((uint8_t*)p)[0];
|
||||
return sizeof(uint8_t);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetI8(uint8_t* p, int8_t* v) {
|
||||
if (v) *v = ((int8_t*)p)[0];
|
||||
return sizeof(int8_t);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetU16(uint8_t* p, uint16_t* v) {
|
||||
if (v) *v = ((uint16_t*)p)[0];
|
||||
return sizeof(uint16_t);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetI16(uint8_t* p, int16_t* v) {
|
||||
if (v) *v = ((int16_t*)p)[0];
|
||||
return sizeof(int16_t);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetU32(uint8_t* p, uint32_t* v) {
|
||||
if (v) *v = ((uint32_t*)p)[0];
|
||||
return sizeof(uint32_t);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetI32(uint8_t* p, int32_t* v) {
|
||||
if (v) *v = ((int32_t*)p)[0];
|
||||
return sizeof(int32_t);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetU64(uint8_t* p, uint64_t* v) {
|
||||
if (v) *v = ((uint64_t*)p)[0];
|
||||
return sizeof(uint64_t);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetI64(uint8_t* p, int64_t* v) {
|
||||
if (v) *v = ((int64_t*)p)[0];
|
||||
return sizeof(int64_t);
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetU16v(uint8_t* p, uint16_t* v) {
|
||||
int32_t n = 0;
|
||||
|
||||
if (v) *v = 0;
|
||||
for (;;) {
|
||||
if (p[n] <= 0x7f) {
|
||||
if (v) (*v) |= (((uint16_t)p[n]) << (7 * n));
|
||||
n++;
|
||||
break;
|
||||
}
|
||||
if (v) (*v) |= (((uint16_t)(p[n] & 0x7f)) << (7 * n));
|
||||
n++;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetI16v(uint8_t* p, int16_t* v) {
|
||||
int32_t n;
|
||||
uint16_t tv;
|
||||
int32_t n = tGetU16v(p, &tv, forward);
|
||||
if (v) {
|
||||
*v = ZIGZAGD(int16_t, tv);
|
||||
}
|
||||
|
||||
n = tGetU16v(p, &tv);
|
||||
if (v) *v = ZIGZAGD(int16_t, tv);
|
||||
|
||||
return n;
|
||||
}
|
||||
static FORCE_INLINE int32_t tGetU32v(uint8_t* p, uint32_t* v, bool forward) { TGETV(p, v, forward); }
|
||||
static FORCE_INLINE int32_t tGetI32v(uint8_t* p, int32_t* v, bool forward) {
|
||||
|
||||
static FORCE_INLINE int32_t tGetU32v(uint8_t* p, uint32_t* v) {
|
||||
int32_t n = 0;
|
||||
|
||||
if (v) *v = 0;
|
||||
for (;;) {
|
||||
if (p[n] <= 0x7f) {
|
||||
if (v) (*v) |= (((uint32_t)p[n]) << (7 * n));
|
||||
n++;
|
||||
break;
|
||||
}
|
||||
if (v) (*v) |= (((uint32_t)(p[n] & 0x7f)) << (7 * n));
|
||||
n++;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetI32v(uint8_t* p, int32_t* v) {
|
||||
int32_t n;
|
||||
uint32_t tv;
|
||||
int32_t n = tGetU32v(p, &tv, forward);
|
||||
if (v) {
|
||||
*v = ZIGZAGD(int32_t, tv);
|
||||
}
|
||||
|
||||
n = tGetU32v(p, &tv);
|
||||
if (v) *v = ZIGZAGD(int32_t, tv);
|
||||
|
||||
return n;
|
||||
}
|
||||
static FORCE_INLINE int32_t tGetU64v(uint8_t* p, uint64_t* v, bool forward) { TGETV(p, v, forward); }
|
||||
static FORCE_INLINE int32_t tGetI64v(uint8_t* p, int64_t* v, bool forward) {
|
||||
|
||||
static FORCE_INLINE int32_t tGetU64v(uint8_t* p, uint64_t* v) {
|
||||
int32_t n = 0;
|
||||
|
||||
if (v) *v = 0;
|
||||
for (;;) {
|
||||
if (p[n] <= 0x7f) {
|
||||
if (v) (*v) |= (((uint64_t)p[n]) << (7 * n));
|
||||
n++;
|
||||
break;
|
||||
}
|
||||
if (v) (*v) |= (((uint64_t)(p[n] & 0x7f)) << (7 * n));
|
||||
n++;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetI64v(uint8_t* p, int64_t* v) {
|
||||
int32_t n;
|
||||
uint64_t tv;
|
||||
int32_t n = tGetU64v(p, &tv, forward);
|
||||
if (v) {
|
||||
*v = ZIGZAGD(int64_t, tv);
|
||||
}
|
||||
|
||||
n = tGetU64v(p, &tv);
|
||||
if (v) *v = ZIGZAGD(int64_t, tv);
|
||||
|
||||
return n;
|
||||
}
|
||||
static FORCE_INLINE int32_t tGetFloat(uint8_t* p, float* f, bool forward) {
|
||||
|
||||
static FORCE_INLINE int32_t tGetFloat(uint8_t* p, float* f) {
|
||||
int32_t n = 0;
|
||||
|
||||
union {
|
||||
uint32_t ui;
|
||||
float f;
|
||||
} v;
|
||||
|
||||
int32_t n = tGetU32(p, &v.ui, forward);
|
||||
if (f) {
|
||||
*f = v.f;
|
||||
}
|
||||
n = tGetU32(p, &v.ui);
|
||||
|
||||
*f = v.f;
|
||||
return n;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetDouble(uint8_t* p, double* d, bool forward) {
|
||||
static FORCE_INLINE int32_t tGetDouble(uint8_t* p, double* d) {
|
||||
int32_t n = 0;
|
||||
|
||||
union {
|
||||
uint64_t ui;
|
||||
double d;
|
||||
} v;
|
||||
|
||||
int32_t n = tGetU64(p, &v.ui, forward);
|
||||
if (d) {
|
||||
*d = v.d;
|
||||
}
|
||||
n = tGetU64(p, &v.ui);
|
||||
|
||||
*d = v.d;
|
||||
return n;
|
||||
}
|
||||
|
||||
// =====================
|
||||
static FORCE_INLINE int32_t tPutBinary(uint8_t* p, uint8_t* pData, uint32_t nData, bool forward) {
|
||||
int32_t n = tPutU32v(p, nData, forward);
|
||||
if (p) {
|
||||
if (forward) {
|
||||
memcpy(p + n, pData, nData);
|
||||
} else {
|
||||
memcpy(p - n - nData, pData, nData);
|
||||
}
|
||||
}
|
||||
static FORCE_INLINE int32_t tPutBinary(uint8_t* p, uint8_t* pData, uint32_t nData) {
|
||||
int n = 0;
|
||||
|
||||
n += tPutU32v(p ? p + n : p, nData);
|
||||
if (p) memcpy(p + n, pData, nData);
|
||||
n += nData;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tGetBinary(uint8_t* p, uint8_t** ppData, uint32_t* nData, bool forward) {
|
||||
static FORCE_INLINE int32_t tGetBinary(uint8_t* p, uint8_t** ppData, uint32_t* nData) {
|
||||
int32_t n = 0;
|
||||
uint32_t nt;
|
||||
int32_t n = tGetU32v(p, &nt, forward);
|
||||
if (nData) {
|
||||
*nData = nt;
|
||||
}
|
||||
if (ppData) {
|
||||
if (forward) {
|
||||
*ppData = p + n;
|
||||
} else {
|
||||
*ppData = p - n - nt;
|
||||
}
|
||||
}
|
||||
return n + nt;
|
||||
|
||||
n += tGetU32v(p, &nt);
|
||||
if (nData) *nData = nt;
|
||||
if (ppData) *ppData = p + n;
|
||||
n += nt;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
static FORCE_INLINE int32_t tPutCStr(uint8_t* p, char* pData, bool forward) {
|
||||
return tPutBinary(p, (uint8_t*)pData, strlen(pData) + 1, forward);
|
||||
}
|
||||
static FORCE_INLINE int32_t tGetCStr(uint8_t* p, char** ppData, bool forward) {
|
||||
return tGetBinary(p, (uint8_t**)ppData, NULL, forward);
|
||||
static FORCE_INLINE int32_t tPutCStr(uint8_t* p, char* pData) {
|
||||
return tPutBinary(p, (uint8_t*)pData, strlen(pData) + 1);
|
||||
}
|
||||
static FORCE_INLINE int32_t tGetCStr(uint8_t* p, char** ppData) { return tGetBinary(p, (uint8_t**)ppData, NULL); }
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -93,21 +93,20 @@ int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
|
|||
flag |= HAS_VALUE;
|
||||
maxIdx = nkv;
|
||||
if (IS_VAR_DATA_TYPE(pTColumn->type)) {
|
||||
ntp = ntp + tPutU32v(NULL, pColVal->value.nData, true) + pColVal->value.nData;
|
||||
nkv = nkv + tPutI16v(NULL, pTColumn->colId, true) + tPutU32v(NULL, pColVal->value.nData, true) +
|
||||
pColVal->value.nData;
|
||||
ntp = ntp + tPutU32v(NULL, pColVal->value.nData) + pColVal->value.nData;
|
||||
nkv = nkv + tPutI16v(NULL, pTColumn->colId) + tPutU32v(NULL, pColVal->value.nData) + pColVal->value.nData;
|
||||
} else {
|
||||
nkv = nkv + tPutI16v(NULL, pTColumn->colId, true) + pTColumn->bytes;
|
||||
nkv = nkv + tPutI16v(NULL, pTColumn->colId) + pTColumn->bytes;
|
||||
}
|
||||
|
||||
if (pTColumn->flags & COL_IS_KEY) {
|
||||
flag |= HAS_MULTI_KEY;
|
||||
numPrimaryKeyCols++;
|
||||
ntp += (tPutI8(NULL, pTColumn->type, false) // type
|
||||
+ tPutI32v(NULL, pTColumn->offset, false) // offset
|
||||
ntp += (tPutI8(NULL, pTColumn->type) // type
|
||||
+ tPutI32v(NULL, pTColumn->offset) // offset
|
||||
);
|
||||
nkv += (tPutI8(NULL, pTColumn->type, false) // type
|
||||
+ tPutI32v(NULL, nIdx, false) // index
|
||||
nkv += (tPutI8(NULL, pTColumn->type) // type
|
||||
+ tPutI32v(NULL, nIdx) // index
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -119,7 +118,7 @@ int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
|
|||
ASSERT((pTColumn->flags & COL_IS_KEY) == 0);
|
||||
flag |= HAS_NULL;
|
||||
maxIdx = nkv;
|
||||
nkv += tPutI16v(NULL, -pTColumn->colId, true);
|
||||
nkv += tPutI16v(NULL, -pTColumn->colId);
|
||||
nIdx++;
|
||||
} else {
|
||||
if (ASSERTS(0, "invalid input")) {
|
||||
|
@ -171,9 +170,9 @@ int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
|
|||
}
|
||||
}
|
||||
if (flag & HAS_MULTI_KEY) {
|
||||
ntp += (tPutI8(NULL, numPrimaryKeyCols, false) // numPrimaryKeyCols
|
||||
+ tPutU32v(NULL, pTSchema->numOfCols, false) // numOfCols
|
||||
+ tPutU32v(NULL, pTSchema->flen, false) // fixedLen
|
||||
ntp += (tPutI8(NULL, numPrimaryKeyCols) // numPrimaryKeyCols
|
||||
+ tPutU32v(NULL, pTSchema->numOfCols) // numOfCols
|
||||
+ tPutU32v(NULL, pTSchema->flen) // fixedLen
|
||||
);
|
||||
}
|
||||
// Key-Value Row Format
|
||||
|
@ -188,7 +187,7 @@ int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
|
|||
flag |= KV_FLG_BIG;
|
||||
}
|
||||
if (flag & HAS_MULTI_KEY) {
|
||||
nkv += tPutI8(NULL, numPrimaryKeyCols, false);
|
||||
nkv += tPutI8(NULL, numPrimaryKeyCols);
|
||||
}
|
||||
int32_t rowLength;
|
||||
if (nkv < ntp) {
|
||||
|
@ -225,9 +224,9 @@ int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
|
|||
uint8_t *pEnd = ((uint8_t *)pRow) + rowLength;
|
||||
|
||||
if (pRow->flag & HAS_MULTI_KEY) {
|
||||
pEnd -= tPutI8(pEnd, numPrimaryKeyCols, false); // numPrimaryKeyCols
|
||||
pEnd -= tPutU32v(pEnd, pTSchema->numOfCols, false); // numOfCols
|
||||
pEnd -= tPutU32v(NULL, pTSchema->flen, false); // fixedLen
|
||||
pEnd -= tPutI8(pEnd, numPrimaryKeyCols); // numPrimaryKeyCols
|
||||
pEnd -= tPutU32v(pEnd, pTSchema->numOfCols); // numOfCols
|
||||
pEnd -= tPutU32v(NULL, pTSchema->flen); // fixedLen
|
||||
}
|
||||
if (flag >> 4) { // KV
|
||||
SKVIdx *pIdx = (SKVIdx *)pRow->data;
|
||||
|
@ -255,9 +254,9 @@ int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
|
|||
((uint32_t *)pIdx->idx)[iIdx] = (uint32_t)nv;
|
||||
}
|
||||
|
||||
nv += tPutI16v(pv + nv, pTColumn->colId, true);
|
||||
nv += tPutI16v(pv + nv, pTColumn->colId);
|
||||
if (IS_VAR_DATA_TYPE(pTColumn->type)) {
|
||||
nv += tPutU32v(pv + nv, pColVal->value.nData, true);
|
||||
nv += tPutU32v(pv + nv, pColVal->value.nData);
|
||||
memcpy(pv + nv, pColVal->value.pData, pColVal->value.nData);
|
||||
nv += pColVal->value.nData;
|
||||
} else {
|
||||
|
@ -266,8 +265,8 @@ int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
|
|||
}
|
||||
|
||||
if (pRow->flag & HAS_MULTI_KEY) {
|
||||
pEnd -= tPutI8(pEnd, pTColumn->type, false);
|
||||
pEnd -= tPutI32v(pEnd, iIdx, false);
|
||||
pEnd -= tPutI8(pEnd, pTColumn->type);
|
||||
pEnd -= tPutI32v(pEnd, iIdx);
|
||||
}
|
||||
|
||||
iIdx++;
|
||||
|
@ -279,7 +278,7 @@ int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
|
|||
} else {
|
||||
((uint32_t *)pIdx->idx)[iIdx] = (uint32_t)nv;
|
||||
}
|
||||
nv += tPutI16v(pv + nv, -pTColumn->colId, true);
|
||||
nv += tPutI16v(pv + nv, -pTColumn->colId);
|
||||
iIdx++;
|
||||
}
|
||||
|
||||
|
@ -343,7 +342,7 @@ int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
|
|||
|
||||
if (IS_VAR_DATA_TYPE(pTColumn->type)) {
|
||||
*(int32_t *)(pf + pTColumn->offset) = nv;
|
||||
nv += tPutU32v(pv + nv, pColVal->value.nData, true);
|
||||
nv += tPutU32v(pv + nv, pColVal->value.nData);
|
||||
if (pColVal->value.nData) {
|
||||
memcpy(pv + nv, pColVal->value.pData, pColVal->value.nData);
|
||||
nv += pColVal->value.nData;
|
||||
|
@ -353,8 +352,8 @@ int32_t tRowBuild(SArray *aColVal, const STSchema *pTSchema, SRow **ppRow) {
|
|||
}
|
||||
|
||||
if (pTColumn->flags & COL_IS_KEY) {
|
||||
pEnd -= tPutI8(pEnd, pTColumn->type, false);
|
||||
pEnd -= tPutI32v(pEnd, pTColumn->offset, false);
|
||||
pEnd -= tPutI8(pEnd, pTColumn->type);
|
||||
pEnd -= tPutI32v(pEnd, pTColumn->offset);
|
||||
}
|
||||
} else if (COL_VAL_IS_NONE(pColVal)) { // NONE
|
||||
ROW_SET_BITMAP(pb, flag, iTColumn - 1, BIT_FLG_NONE);
|
||||
|
@ -440,7 +439,7 @@ int32_t tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal)
|
|||
}
|
||||
|
||||
int16_t cid;
|
||||
pData += tGetI16v(pData, &cid, true);
|
||||
pData += tGetI16v(pData, &cid);
|
||||
|
||||
if (TABS(cid) == pTColumn->colId) {
|
||||
if (cid < 0) {
|
||||
|
@ -451,7 +450,7 @@ int32_t tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal)
|
|||
pColVal->flag = CV_FLAG_VALUE;
|
||||
|
||||
if (IS_VAR_DATA_TYPE(pTColumn->type)) {
|
||||
pData += tGetU32v(pData, &pColVal->value.nData, true);
|
||||
pData += tGetU32v(pData, &pColVal->value.nData);
|
||||
if (pColVal->value.nData > 0) {
|
||||
pColVal->value.pData = pData;
|
||||
} else {
|
||||
|
@ -477,7 +476,7 @@ int32_t tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal)
|
|||
pColVal->flag = CV_FLAG_VALUE;
|
||||
if (IS_VAR_DATA_TYPE(pTColumn->type)) {
|
||||
uint8_t *pData = pRow->data + pTSchema->flen + *(int32_t *)(pRow->data + pTColumn->offset);
|
||||
pData += tGetU32v(pData, &pColVal->value.nData, true);
|
||||
pData += tGetU32v(pData, &pColVal->value.nData);
|
||||
if (pColVal->value.nData) {
|
||||
pColVal->value.pData = pData;
|
||||
} else {
|
||||
|
@ -530,7 +529,7 @@ int32_t tRowGet(SRow *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal)
|
|||
pColVal->flag = CV_FLAG_VALUE;
|
||||
if (IS_VAR_DATA_TYPE(pTColumn->type)) {
|
||||
uint8_t *pData = pv + *(int32_t *)(pf + pTColumn->offset);
|
||||
pData += tGetU32v(pData, &pColVal->value.nData, true);
|
||||
pData += tGetU32v(pData, &pColVal->value.nData);
|
||||
if (pColVal->value.nData) {
|
||||
pColVal->value.pData = pData;
|
||||
} else {
|
||||
|
@ -793,7 +792,7 @@ SColVal *tRowIterNext(SRowIter *pIter) {
|
|||
}
|
||||
|
||||
int16_t cid;
|
||||
pData += tGetI16v(pData, &cid, true);
|
||||
pData += tGetI16v(pData, &cid);
|
||||
|
||||
if (TABS(cid) == pTColumn->colId) {
|
||||
if (cid < 0) {
|
||||
|
@ -804,7 +803,7 @@ SColVal *tRowIterNext(SRowIter *pIter) {
|
|||
pIter->cv.flag = CV_FLAG_VALUE;
|
||||
|
||||
if (IS_VAR_DATA_TYPE(pTColumn->type)) {
|
||||
pData += tGetU32v(pData, &pIter->cv.value.nData, true);
|
||||
pData += tGetU32v(pData, &pIter->cv.value.nData);
|
||||
if (pIter->cv.value.nData > 0) {
|
||||
pIter->cv.value.pData = pData;
|
||||
} else {
|
||||
|
@ -863,7 +862,7 @@ SColVal *tRowIterNext(SRowIter *pIter) {
|
|||
pIter->cv.flag = CV_FLAG_VALUE;
|
||||
if (IS_VAR_DATA_TYPE(pTColumn->type)) {
|
||||
uint8_t *pData = pIter->pv + *(int32_t *)(pIter->pf + pTColumn->offset);
|
||||
pData += tGetU32v(pData, &pIter->cv.value.nData, true);
|
||||
pData += tGetU32v(pData, &pIter->cv.value.nData);
|
||||
if (pIter->cv.value.nData > 0) {
|
||||
pIter->cv.value.pData = pData;
|
||||
} else {
|
||||
|
@ -1006,7 +1005,7 @@ static int32_t tRowTupleUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *
|
|||
if (IS_VAR_DATA_TYPE(pColData->type)) {
|
||||
uint8_t *pData = pv + *(int32_t *)(pf + pTColumn->offset);
|
||||
uint32_t nData;
|
||||
pData += tGetU32v(pData, &nData, true);
|
||||
pData += tGetU32v(pData, &nData);
|
||||
if (flag == 0) {
|
||||
code = tColDataAppendValueImpl[pColData->flag][CV_FLAG_VALUE](pColData, pData, nData);
|
||||
} else {
|
||||
|
@ -1080,7 +1079,7 @@ static int32_t tRowKVUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *aCo
|
|||
}
|
||||
|
||||
int16_t cid;
|
||||
pData += tGetI16v(pData, &cid, true);
|
||||
pData += tGetI16v(pData, &cid);
|
||||
|
||||
if (TABS(cid) == pTColumn->colId) {
|
||||
if (cid < 0) {
|
||||
|
@ -1093,7 +1092,7 @@ static int32_t tRowKVUpsertColData(SRow *pRow, STSchema *pTSchema, SColData *aCo
|
|||
} else {
|
||||
uint32_t nData;
|
||||
if (IS_VAR_DATA_TYPE(pTColumn->type)) {
|
||||
pData += tGetU32v(pData, &nData, true);
|
||||
pData += tGetU32v(pData, &nData);
|
||||
} else {
|
||||
nData = 0;
|
||||
}
|
||||
|
@ -1160,7 +1159,7 @@ void tRowGetKey(SRow *pRow, SRowKey *key) {
|
|||
} else {
|
||||
uint8_t *pEnd = ((uint8_t *)pRow) + pRow->len;
|
||||
|
||||
pEnd -= tGetU8(pEnd, &key->numOfPKs, false);
|
||||
pEnd -= tGetU8(pEnd, &key->numOfPKs);
|
||||
|
||||
if (pRow->flag >> 4) { // Key-Value format
|
||||
SKVIdx *pKVIdx = (SKVIdx *)pRow->data;
|
||||
|
@ -1179,8 +1178,8 @@ void tRowGetKey(SRow *pRow, SRowKey *key) {
|
|||
uint8_t *pData;
|
||||
SValue *pValue = &key->pks[iKey];
|
||||
|
||||
pEnd -= tGetI8(pEnd, &pValue->type, false);
|
||||
pEnd -= tGetI32v(pEnd, &index, false);
|
||||
pEnd -= tGetI8(pEnd, &pValue->type);
|
||||
pEnd -= tGetI32v(pEnd, &index);
|
||||
|
||||
if (pRow->flag & KV_FLG_LIT) {
|
||||
pData = pv + ((uint8_t *)pKVIdx->idx)[index];
|
||||
|
@ -1190,9 +1189,9 @@ void tRowGetKey(SRow *pRow, SRowKey *key) {
|
|||
pData = pv + ((uint32_t *)pKVIdx->idx)[index];
|
||||
}
|
||||
|
||||
pData += tGetI16v(pData, NULL, true);
|
||||
pData += tGetI16v(pData, NULL);
|
||||
if (IS_VAR_DATA_TYPE(pValue->type)) {
|
||||
pData += tGetU32v(pData, &pValue->nData, true);
|
||||
pData += tGetU32v(pData, &pValue->nData);
|
||||
pValue->pData = pData;
|
||||
} else {
|
||||
memcpy(&pValue->val, pData, TYPE_BYTES[pValue->type]);
|
||||
|
@ -1204,8 +1203,8 @@ void tRowGetKey(SRow *pRow, SRowKey *key) {
|
|||
uint32_t fixedLen;
|
||||
uint32_t numOfCols;
|
||||
|
||||
pEnd -= tGetU32v(pEnd, &numOfCols, false);
|
||||
pEnd -= tGetU32v(pEnd, &fixedLen, false);
|
||||
pEnd -= tGetU32v(pEnd, &numOfCols);
|
||||
pEnd -= tGetU32v(pEnd, &fixedLen);
|
||||
|
||||
switch (pRow->flag & (HAS_VALUE | HAS_NULL | HAS_NONE)) {
|
||||
case (HAS_VALUE | HAS_NONE):
|
||||
|
@ -1225,12 +1224,12 @@ void tRowGetKey(SRow *pRow, SRowKey *key) {
|
|||
int32_t offset;
|
||||
SValue *pValue = &key->pks[iKey];
|
||||
|
||||
pEnd -= tGetI8(pEnd, &pValue->type, false);
|
||||
pEnd -= tGetI32v(pEnd, &offset, false);
|
||||
pEnd -= tGetI8(pEnd, &pValue->type);
|
||||
pEnd -= tGetI32v(pEnd, &offset);
|
||||
|
||||
if (IS_VAR_DATA_TYPE(key->pks[iKey].type)) {
|
||||
pValue->pData = pv + *(int32_t *)(pf + offset);
|
||||
pValue->pData += tGetU32v(pValue->pData, &pValue->nData, true);
|
||||
pValue->pData += tGetU32v(pValue->pData, &pValue->nData);
|
||||
} else {
|
||||
memcpy(&key->pks[iKey].val, pf + offset, TYPE_BYTES[key->pks[iKey].type]);
|
||||
}
|
||||
|
@ -1430,18 +1429,18 @@ static int32_t tPutTagVal(uint8_t *p, STagVal *pTagVal, int8_t isJson) {
|
|||
|
||||
// key
|
||||
if (isJson) {
|
||||
n += tPutCStr(p ? p + n : p, pTagVal->pKey, true);
|
||||
n += tPutCStr(p ? p + n : p, pTagVal->pKey);
|
||||
} else {
|
||||
n += tPutI16v(p ? p + n : p, pTagVal->cid, true);
|
||||
n += tPutI16v(p ? p + n : p, pTagVal->cid);
|
||||
ASSERTS(pTagVal->cid > 0, "Invalid tag cid:%" PRIi16, pTagVal->cid);
|
||||
}
|
||||
|
||||
// type
|
||||
n += tPutI8(p ? p + n : p, pTagVal->type, true);
|
||||
n += tPutI8(p ? p + n : p, pTagVal->type);
|
||||
|
||||
// value
|
||||
if (IS_VAR_DATA_TYPE(pTagVal->type)) {
|
||||
n += tPutBinary(p ? p + n : p, pTagVal->pData, pTagVal->nData, true);
|
||||
n += tPutBinary(p ? p + n : p, pTagVal->pData, pTagVal->nData);
|
||||
} else {
|
||||
p = p ? p + n : p;
|
||||
n += tDataTypes[pTagVal->type].bytes;
|
||||
|
@ -1455,17 +1454,17 @@ static int32_t tGetTagVal(uint8_t *p, STagVal *pTagVal, int8_t isJson) {
|
|||
|
||||
// key
|
||||
if (isJson) {
|
||||
n += tGetCStr(p + n, &pTagVal->pKey, true);
|
||||
n += tGetCStr(p + n, &pTagVal->pKey);
|
||||
} else {
|
||||
n += tGetI16v(p + n, &pTagVal->cid, true);
|
||||
n += tGetI16v(p + n, &pTagVal->cid);
|
||||
}
|
||||
|
||||
// type
|
||||
n += tGetI8(p + n, &pTagVal->type, true);
|
||||
n += tGetI8(p + n, &pTagVal->type);
|
||||
|
||||
// value
|
||||
if (IS_VAR_DATA_TYPE(pTagVal->type)) {
|
||||
n += tGetBinary(p + n, &pTagVal->pData, &pTagVal->nData, true);
|
||||
n += tGetBinary(p + n, &pTagVal->pData, &pTagVal->nData);
|
||||
} else {
|
||||
memcpy(&(pTagVal->i64), p + n, tDataTypes[pTagVal->type].bytes);
|
||||
n += tDataTypes[pTagVal->type].bytes;
|
||||
|
@ -1695,7 +1694,7 @@ void tTagSetCid(const STag *pTag, int16_t iTag, int16_t cid) {
|
|||
offset = pTag->idx[iTag];
|
||||
}
|
||||
|
||||
tPutI16v(p + offset, cid, true);
|
||||
tPutI16v(p + offset, cid);
|
||||
}
|
||||
|
||||
// STSchema ========================================
|
||||
|
@ -2635,20 +2634,12 @@ _exit:
|
|||
return code;
|
||||
}
|
||||
|
||||
int32_t tColDataCompress(SColData *colData, // column data
|
||||
SColDataCompressInfo *info, // compress info
|
||||
void *output, // output
|
||||
int32_t outputSize, // output size
|
||||
SBuffer *buffer // assistant buffer
|
||||
) {
|
||||
int32_t tColDataCompress(SColData *colData, SColDataCompressInfo *info, SBuffer *output, SBuffer *assist) {
|
||||
int32_t code;
|
||||
SBuffer local;
|
||||
char *outputStart = output;
|
||||
|
||||
ASSERT(colData->nVal > 0);
|
||||
|
||||
tBufferInit(&local);
|
||||
|
||||
(*info) = (SColDataCompressInfo){
|
||||
.cmprAlg = info->cmprAlg,
|
||||
.columnFlag = colData->cflag,
|
||||
|
@ -2659,12 +2650,12 @@ int32_t tColDataCompress(SColData *colData, // column data
|
|||
};
|
||||
|
||||
if (colData->flag == HAS_NONE || colData->flag == HAS_NULL) {
|
||||
tBufferDestroy(&local);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (buffer == NULL) {
|
||||
buffer = &local;
|
||||
tBufferInit(&local);
|
||||
if (assist == NULL) {
|
||||
assist = &local;
|
||||
}
|
||||
|
||||
// bitmap
|
||||
|
@ -2680,15 +2671,13 @@ int32_t tColDataCompress(SColData *colData, // column data
|
|||
.cmprAlg = info->cmprAlg,
|
||||
};
|
||||
|
||||
code = tCompressData(colData->pBitMap, info->bitmapOriginalSize, &cinfo, outputStart, outputSize, buffer);
|
||||
code = tCompressDataToBuffer(colData->pBitMap, info->bitmapOriginalSize, &cinfo, output, assist);
|
||||
if (code) {
|
||||
tBufferDestroy(&local);
|
||||
return code;
|
||||
}
|
||||
|
||||
info->bitmapCompressedSize = cinfo.compressedSize;
|
||||
outputStart += cinfo.compressedSize;
|
||||
outputSize -= cinfo.compressedSize;
|
||||
}
|
||||
|
||||
if (colData->flag == (HAS_NONE | HAS_NULL)) {
|
||||
|
@ -2705,15 +2694,13 @@ int32_t tColDataCompress(SColData *colData, // column data
|
|||
.cmprAlg = info->cmprAlg,
|
||||
};
|
||||
|
||||
code = tCompressData(colData->aOffset, info->offsetOriginalSize, &cinfo, outputStart, outputSize, buffer);
|
||||
code = tCompressDataToBuffer(colData->aOffset, info->offsetOriginalSize, &cinfo, output, assist);
|
||||
if (code) {
|
||||
tBufferDestroy(&local);
|
||||
return code;
|
||||
}
|
||||
|
||||
info->offsetCompressedSize = cinfo.compressedSize;
|
||||
outputStart += cinfo.compressedSize;
|
||||
outputSize -= cinfo.compressedSize;
|
||||
}
|
||||
|
||||
// data
|
||||
|
@ -2725,23 +2712,21 @@ int32_t tColDataCompress(SColData *colData, // column data
|
|||
.cmprAlg = info->cmprAlg,
|
||||
};
|
||||
|
||||
code = tCompressData(colData->pData, info->dataOriginalSize, &cinfo, outputStart, outputSize, buffer);
|
||||
code = tCompressDataToBuffer(colData->pData, info->dataOriginalSize, &cinfo, output, assist);
|
||||
if (code) {
|
||||
tBufferDestroy(&local);
|
||||
return code;
|
||||
}
|
||||
|
||||
info->dataCompressedSize = cinfo.compressedSize;
|
||||
outputStart += cinfo.compressedSize;
|
||||
outputSize -= cinfo.compressedSize;
|
||||
}
|
||||
|
||||
tBufferDestroy(&local);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tColDataDecompress(void *input, int32_t inputSize, const SColDataCompressInfo *info, SColData *colData,
|
||||
SBuffer *buffer) {
|
||||
int32_t tColDataDecompress(void *input, int32_t inputSize, SColDataCompressInfo *info, SColData *colData,
|
||||
SBuffer *assist) {
|
||||
int32_t code;
|
||||
SBuffer local;
|
||||
char *inputStart = input;
|
||||
|
@ -2749,8 +2734,8 @@ int32_t tColDataDecompress(void *input, int32_t inputSize, const SColDataCompres
|
|||
ASSERT(inputSize == info->bitmapCompressedSize + info->offsetCompressedSize + info->dataCompressedSize);
|
||||
|
||||
tBufferInit(&local);
|
||||
if (buffer == NULL) {
|
||||
buffer = &local;
|
||||
if (assist == NULL) {
|
||||
assist = &local;
|
||||
}
|
||||
|
||||
tColDataClear(colData);
|
||||
|
@ -2779,7 +2764,7 @@ int32_t tColDataDecompress(void *input, int32_t inputSize, const SColDataCompres
|
|||
return code;
|
||||
}
|
||||
|
||||
code = tDecompressData(inputStart, cinfo.compressedSize, &cinfo, colData->pBitMap, cinfo.originalSize, buffer);
|
||||
code = tDecompressData(inputStart, cinfo.compressedSize, &cinfo, colData->pBitMap, cinfo.originalSize, assist);
|
||||
if (code) {
|
||||
tBufferDestroy(&local);
|
||||
return code;
|
||||
|
@ -2807,7 +2792,7 @@ int32_t tColDataDecompress(void *input, int32_t inputSize, const SColDataCompres
|
|||
return code;
|
||||
}
|
||||
|
||||
code = tDecompressData(inputStart, cinfo.compressedSize, &cinfo, colData->aOffset, cinfo.originalSize, buffer);
|
||||
code = tDecompressData(inputStart, cinfo.compressedSize, &cinfo, colData->aOffset, cinfo.originalSize, assist);
|
||||
if (code) {
|
||||
tBufferDestroy(&local);
|
||||
return code;
|
||||
|
@ -2833,7 +2818,7 @@ int32_t tColDataDecompress(void *input, int32_t inputSize, const SColDataCompres
|
|||
return code;
|
||||
}
|
||||
|
||||
code = tDecompressData(inputStart, cinfo.compressedSize, &cinfo, colData->pData, cinfo.originalSize, buffer);
|
||||
code = tDecompressData(inputStart, cinfo.compressedSize, &cinfo, colData->pData, cinfo.originalSize, assist);
|
||||
if (code) {
|
||||
tBufferDestroy(&local);
|
||||
return code;
|
||||
|
@ -3517,10 +3502,10 @@ _exit:
|
|||
int32_t tPutColData(uint8_t *pBuf, SColData *pColData) {
|
||||
int32_t n = 0;
|
||||
|
||||
n += tPutI16v(pBuf ? pBuf + n : NULL, pColData->cid, true);
|
||||
n += tPutI8(pBuf ? pBuf + n : NULL, pColData->type, true);
|
||||
n += tPutI32v(pBuf ? pBuf + n : NULL, pColData->nVal, true);
|
||||
n += tPutI8(pBuf ? pBuf + n : NULL, pColData->flag, true);
|
||||
n += tPutI16v(pBuf ? pBuf + n : NULL, pColData->cid);
|
||||
n += tPutI8(pBuf ? pBuf + n : NULL, pColData->type);
|
||||
n += tPutI32v(pBuf ? pBuf + n : NULL, pColData->nVal);
|
||||
n += tPutI8(pBuf ? pBuf + n : NULL, pColData->flag);
|
||||
|
||||
// bitmap
|
||||
switch (pColData->flag) {
|
||||
|
@ -3544,7 +3529,7 @@ int32_t tPutColData(uint8_t *pBuf, SColData *pColData) {
|
|||
if (pBuf) memcpy(pBuf + n, pColData->aOffset, pColData->nVal << 2);
|
||||
n += (pColData->nVal << 2);
|
||||
|
||||
n += tPutI32v(pBuf ? pBuf + n : NULL, pColData->nData, true);
|
||||
n += tPutI32v(pBuf ? pBuf + n : NULL, pColData->nData);
|
||||
if (pBuf) memcpy(pBuf + n, pColData->pData, pColData->nData);
|
||||
n += pColData->nData;
|
||||
} else {
|
||||
|
@ -3559,10 +3544,10 @@ int32_t tPutColData(uint8_t *pBuf, SColData *pColData) {
|
|||
int32_t tGetColData(uint8_t *pBuf, SColData *pColData) {
|
||||
int32_t n = 0;
|
||||
|
||||
n += tGetI16v(pBuf + n, &pColData->cid, true);
|
||||
n += tGetI8(pBuf + n, &pColData->type, true);
|
||||
n += tGetI32v(pBuf + n, &pColData->nVal, true);
|
||||
n += tGetI8(pBuf + n, &pColData->flag, true);
|
||||
n += tGetI16v(pBuf + n, &pColData->cid);
|
||||
n += tGetI8(pBuf + n, &pColData->type);
|
||||
n += tGetI32v(pBuf + n, &pColData->nVal);
|
||||
n += tGetI8(pBuf + n, &pColData->flag);
|
||||
|
||||
// bitmap
|
||||
switch (pColData->flag) {
|
||||
|
@ -3586,7 +3571,7 @@ int32_t tGetColData(uint8_t *pBuf, SColData *pColData) {
|
|||
pColData->aOffset = (int32_t *)(pBuf + n);
|
||||
n += (pColData->nVal << 2);
|
||||
|
||||
n += tGetI32v(pBuf + n, &pColData->nData, true);
|
||||
n += tGetI32v(pBuf + n, &pColData->nData);
|
||||
pColData->pData = pBuf + n;
|
||||
n += pColData->nData;
|
||||
} else {
|
||||
|
@ -4078,36 +4063,30 @@ int32_t tValueColumnGet(SValueColumn *valCol, int32_t idx, SValue *value) {
|
|||
if (IS_VAR_DATA_TYPE(value->type)) {
|
||||
int32_t offset, nextOffset;
|
||||
|
||||
memcpy(&offset, (char *)tBufferGetData(&valCol->offsets) + idx * sizeof(offset), sizeof(offset));
|
||||
tBufferGet(&valCol->offsets, idx, sizeof(offset), &offset);
|
||||
if (idx == valCol->numOfValues - 1) {
|
||||
nextOffset = tBufferGetSize(&valCol->data);
|
||||
} else {
|
||||
memcpy(&nextOffset, (char *)tBufferGetData(&valCol->offsets) + (idx + 1) * sizeof(nextOffset),
|
||||
sizeof(nextOffset));
|
||||
tBufferGet(&valCol->offsets, idx + 1, sizeof(nextOffset), &nextOffset);
|
||||
}
|
||||
value->nData = nextOffset - offset;
|
||||
value->pData = (uint8_t *)((char *)tBufferGetData(&valCol->data) + offset);
|
||||
value->pData = (uint8_t *)tBufferGetDataAt(&valCol->data, offset);
|
||||
} else {
|
||||
memcpy(&value->val, (char *)tBufferGetData(&valCol->data) + idx * tDataTypes[value->type].bytes,
|
||||
tDataTypes[value->type].bytes);
|
||||
tBufferGet(&valCol->data, idx, tDataTypes[value->type].bytes, &value->val);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t tValueColumnCompress(SValueColumn *valCol, SValueColumnCompressInfo *info, SBuffer *output, SBuffer *assist) {
|
||||
int32_t code;
|
||||
SBuffer local;
|
||||
|
||||
ASSERT(valCol->numOfValues > 0);
|
||||
|
||||
(*info) = (SValueColumnCompressInfo){
|
||||
.cmprAlg = info->cmprAlg,
|
||||
.type = valCol->type,
|
||||
};
|
||||
|
||||
tBufferInit(&local);
|
||||
if (assist == NULL) {
|
||||
assist = &local;
|
||||
}
|
||||
|
||||
// offset
|
||||
if (IS_VAR_DATA_TYPE(valCol->type)) {
|
||||
SCompressInfo cinfo = {
|
||||
|
@ -4116,13 +4095,10 @@ int32_t tValueColumnCompress(SValueColumn *valCol, SValueColumnCompressInfo *inf
|
|||
};
|
||||
|
||||
code = tCompressDataToBuffer(valCol->offsets.data, valCol->offsets.size, &cinfo, output, assist);
|
||||
if (code) {
|
||||
tBufferDestroy(&local);
|
||||
return code;
|
||||
}
|
||||
if (code) return code;
|
||||
|
||||
info->originalOffsetSize = cinfo.originalSize;
|
||||
info->compressedOffsetSize = cinfo.compressedSize;
|
||||
info->offsetOriginalSize = cinfo.originalSize;
|
||||
info->offsetCompressedSize = cinfo.compressedSize;
|
||||
}
|
||||
|
||||
// data
|
||||
|
@ -4132,14 +4108,11 @@ int32_t tValueColumnCompress(SValueColumn *valCol, SValueColumnCompressInfo *inf
|
|||
};
|
||||
|
||||
code = tCompressDataToBuffer(valCol->data.data, valCol->data.size, &cinfo, output, assist);
|
||||
if (code) {
|
||||
tBufferGetData(&local);
|
||||
return code;
|
||||
}
|
||||
info->originalDataSize = cinfo.originalSize;
|
||||
info->compressedDataSize = cinfo.compressedSize;
|
||||
if (code) return code;
|
||||
|
||||
info->dataOriginalSize = cinfo.originalSize;
|
||||
info->dataCompressedSize = cinfo.compressedSize;
|
||||
|
||||
tBufferDestroy(&local);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -4149,7 +4122,7 @@ int32_t tValueColumnDecompress(void *input, int32_t inputSize, const SValueColum
|
|||
SBuffer local;
|
||||
char *inputStart = input;
|
||||
|
||||
ASSERT(inputSize == info->compressedOffsetSize + info->compressedDataSize);
|
||||
ASSERT(inputSize == info->offsetCompressedSize + info->dataCompressedSize);
|
||||
|
||||
tValueColumnClear(valCol);
|
||||
tBufferInit(&local);
|
||||
|
@ -4161,13 +4134,13 @@ int32_t tValueColumnDecompress(void *input, int32_t inputSize, const SValueColum
|
|||
valCol->type = info->type;
|
||||
// offset
|
||||
if (IS_VAR_DATA_TYPE(valCol->type)) {
|
||||
valCol->numOfValues = info->originalOffsetSize / tDataTypes[TSDB_DATA_TYPE_INT].bytes;
|
||||
valCol->numOfValues = info->offsetOriginalSize / tDataTypes[TSDB_DATA_TYPE_INT].bytes;
|
||||
|
||||
SCompressInfo cinfo = {
|
||||
.dataType = TSDB_DATA_TYPE_INT,
|
||||
.cmprAlg = info->cmprAlg,
|
||||
.originalSize = info->originalOffsetSize,
|
||||
.compressedSize = info->compressedOffsetSize,
|
||||
.originalSize = info->offsetOriginalSize,
|
||||
.compressedSize = info->offsetCompressedSize,
|
||||
};
|
||||
|
||||
code = tBufferEnsureCapacity(&valCol->offsets, cinfo.originalSize);
|
||||
|
@ -4184,15 +4157,15 @@ int32_t tValueColumnDecompress(void *input, int32_t inputSize, const SValueColum
|
|||
valCol->offsets.size = cinfo.originalSize;
|
||||
inputStart += cinfo.compressedSize;
|
||||
} else {
|
||||
valCol->numOfValues = info->originalDataSize / tDataTypes[valCol->type].bytes;
|
||||
valCol->numOfValues = info->dataOriginalSize / tDataTypes[valCol->type].bytes;
|
||||
}
|
||||
|
||||
// data
|
||||
SCompressInfo cinfo = {
|
||||
.dataType = valCol->type,
|
||||
.cmprAlg = info->cmprAlg,
|
||||
.originalSize = info->originalDataSize,
|
||||
.compressedSize = info->compressedDataSize,
|
||||
.originalSize = info->dataOriginalSize,
|
||||
.compressedSize = info->dataCompressedSize,
|
||||
};
|
||||
|
||||
code = tBufferEnsureCapacity(&valCol->data, cinfo.originalSize);
|
||||
|
@ -4226,13 +4199,13 @@ int32_t tValueColumnCompressInfoEncode(const SValueColumnCompressInfo *compressI
|
|||
if (code) return code;
|
||||
code = tBufferPutI8(writer, compressInfo->type);
|
||||
if (code) return code;
|
||||
code = tBufferPutI32v(writer, compressInfo->originalDataSize);
|
||||
code = tBufferPutI32v(writer, compressInfo->dataOriginalSize);
|
||||
if (code) return code;
|
||||
code = tBufferPutI32v(writer, compressInfo->compressedDataSize);
|
||||
code = tBufferPutI32v(writer, compressInfo->dataCompressedSize);
|
||||
if (code) return code;
|
||||
code = tBufferPutI32v(writer, compressInfo->originalOffsetSize);
|
||||
code = tBufferPutI32v(writer, compressInfo->offsetOriginalSize);
|
||||
if (code) return code;
|
||||
code = tBufferPutI32v(writer, compressInfo->compressedOffsetSize);
|
||||
code = tBufferPutI32v(writer, compressInfo->offsetCompressedSize);
|
||||
if (code) return code;
|
||||
|
||||
return 0;
|
||||
|
@ -4251,13 +4224,13 @@ int32_t tValueColumnCompressInfoDecode(SBufferReader *reader, SValueColumnCompre
|
|||
if (code) return code;
|
||||
code = tBufferGetI8(reader, &compressInfo->type);
|
||||
if (code) return code;
|
||||
code = tBufferGetI32v(reader, &compressInfo->originalDataSize);
|
||||
code = tBufferGetI32v(reader, &compressInfo->dataOriginalSize);
|
||||
if (code) return code;
|
||||
code = tBufferGetI32v(reader, &compressInfo->compressedDataSize);
|
||||
code = tBufferGetI32v(reader, &compressInfo->dataCompressedSize);
|
||||
if (code) return code;
|
||||
code = tBufferGetI32v(reader, &compressInfo->originalOffsetSize);
|
||||
code = tBufferGetI32v(reader, &compressInfo->offsetOriginalSize);
|
||||
if (code) return code;
|
||||
code = tBufferGetI32v(reader, &compressInfo->compressedOffsetSize);
|
||||
code = tBufferGetI32v(reader, &compressInfo->offsetCompressedSize);
|
||||
if (code) return code;
|
||||
} else {
|
||||
return TSDB_CODE_INVALID_DATA_FMT;
|
||||
|
@ -4287,13 +4260,16 @@ int32_t tCompressData(void *input, // input
|
|||
SBuffer local;
|
||||
|
||||
tBufferInit(&local);
|
||||
if (info->cmprAlg == TWO_STAGE_COMP) {
|
||||
if (buffer == NULL) {
|
||||
buffer = &local;
|
||||
}
|
||||
if (buffer == NULL) {
|
||||
buffer = &local;
|
||||
}
|
||||
|
||||
if (info->cmprAlg == TWO_STAGE_COMP) {
|
||||
code = tBufferEnsureCapacity(buffer, extraSizeNeeded);
|
||||
if (code) return code;
|
||||
if (code) {
|
||||
tBufferDestroy(&local);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
info->compressedSize = tDataTypes[info->dataType].compFunc( //
|
||||
|
@ -4304,7 +4280,7 @@ int32_t tCompressData(void *input, // input
|
|||
outputSize, // output size
|
||||
info->cmprAlg, // compression algorithm
|
||||
buffer->data, // buffer
|
||||
extraSizeNeeded // buffer size
|
||||
buffer->capacity // buffer size
|
||||
);
|
||||
if (info->compressedSize < 0) {
|
||||
tBufferDestroy(&local);
|
||||
|
@ -4335,12 +4311,16 @@ int32_t tDecompressData(void *input, // input
|
|||
SBuffer local;
|
||||
|
||||
tBufferInit(&local);
|
||||
if (buffer == NULL) {
|
||||
buffer = &local;
|
||||
}
|
||||
|
||||
if (info->cmprAlg == TWO_STAGE_COMP) {
|
||||
if (buffer == NULL) {
|
||||
buffer = &local;
|
||||
}
|
||||
code = tBufferEnsureCapacity(buffer, info->originalSize + COMP_OVERFLOW_BYTES);
|
||||
if (code) return code;
|
||||
if (code) {
|
||||
tBufferDestroy(&local);
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t decompressedSize = tDataTypes[info->dataType].decompFunc(
|
||||
|
@ -4378,8 +4358,7 @@ int32_t tCompressDataToBuffer(void *input, int32_t inputSize, SCompressInfo *inf
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t tDecompressDataToBuffer(void *input, int32_t inputSize, const SCompressInfo *info, SBuffer *output,
|
||||
SBuffer *assist) {
|
||||
int32_t tDecompressDataToBuffer(void *input, int32_t inputSize, SCompressInfo *info, SBuffer *output, SBuffer *assist) {
|
||||
int32_t code;
|
||||
|
||||
code = tBufferEnsureCapacity(output, output->size + info->originalSize);
|
||||
|
|
|
@ -23,16 +23,16 @@ static int32_t tsdbFSToBinary(uint8_t *p, STsdbFS *pFS) {
|
|||
uint32_t nSet = taosArrayGetSize(pFS->aDFileSet);
|
||||
|
||||
// version
|
||||
n += tPutI8(p ? p + n : p, 0, true);
|
||||
n += tPutI8(p ? p + n : p, 0);
|
||||
|
||||
// SDelFile
|
||||
n += tPutI8(p ? p + n : p, hasDel, true);
|
||||
n += tPutI8(p ? p + n : p, hasDel);
|
||||
if (hasDel) {
|
||||
n += tPutDelFile(p ? p + n : p, pFS->pDelFile);
|
||||
}
|
||||
|
||||
// SArray<SDFileSet>
|
||||
n += tPutU32v(p ? p + n : p, nSet, true);
|
||||
n += tPutU32v(p ? p + n : p, nSet);
|
||||
for (uint32_t iSet = 0; iSet < nSet; iSet++) {
|
||||
n += tPutDFileSet(p ? p + n : p, (SDFileSet *)taosArrayGet(pFS->aDFileSet, iSet));
|
||||
}
|
||||
|
@ -45,11 +45,11 @@ static int32_t tsdbBinaryToFS(uint8_t *pData, int64_t nData, STsdbFS *pFS) {
|
|||
int32_t n = 0;
|
||||
|
||||
// version
|
||||
n += tGetI8(pData + n, NULL, true);
|
||||
n += tGetI8(pData + n, NULL);
|
||||
|
||||
// SDelFile
|
||||
int8_t hasDel = 0;
|
||||
n += tGetI8(pData + n, &hasDel, true);
|
||||
n += tGetI8(pData + n, &hasDel);
|
||||
if (hasDel) {
|
||||
pFS->pDelFile = (SDelFile *)taosMemoryCalloc(1, sizeof(SDelFile));
|
||||
if (pFS->pDelFile == NULL) {
|
||||
|
@ -66,7 +66,7 @@ static int32_t tsdbBinaryToFS(uint8_t *pData, int64_t nData, STsdbFS *pFS) {
|
|||
// aDFileSet
|
||||
taosArrayClear(pFS->aDFileSet);
|
||||
uint32_t nSet = 0;
|
||||
n += tGetU32v(pData + n, &nSet, true);
|
||||
n += tGetU32v(pData + n, &nSet);
|
||||
for (uint32_t iSet = 0; iSet < nSet; iSet++) {
|
||||
SDFileSet fSet = {0};
|
||||
|
||||
|
|
|
@ -19,9 +19,9 @@
|
|||
int32_t tPutHeadFile(uint8_t *p, SHeadFile *pHeadFile) {
|
||||
int32_t n = 0;
|
||||
|
||||
n += tPutI64v(p ? p + n : p, pHeadFile->commitID, true);
|
||||
n += tPutI64v(p ? p + n : p, pHeadFile->size, true);
|
||||
n += tPutI64v(p ? p + n : p, pHeadFile->offset, true);
|
||||
n += tPutI64v(p ? p + n : p, pHeadFile->commitID);
|
||||
n += tPutI64v(p ? p + n : p, pHeadFile->size);
|
||||
n += tPutI64v(p ? p + n : p, pHeadFile->offset);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -29,9 +29,9 @@ int32_t tPutHeadFile(uint8_t *p, SHeadFile *pHeadFile) {
|
|||
static int32_t tGetHeadFile(uint8_t *p, SHeadFile *pHeadFile) {
|
||||
int32_t n = 0;
|
||||
|
||||
n += tGetI64v(p + n, &pHeadFile->commitID, true);
|
||||
n += tGetI64v(p + n, &pHeadFile->size, true);
|
||||
n += tGetI64v(p + n, &pHeadFile->offset, true);
|
||||
n += tGetI64v(p + n, &pHeadFile->commitID);
|
||||
n += tGetI64v(p + n, &pHeadFile->size);
|
||||
n += tGetI64v(p + n, &pHeadFile->offset);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -39,8 +39,8 @@ static int32_t tGetHeadFile(uint8_t *p, SHeadFile *pHeadFile) {
|
|||
int32_t tPutDataFile(uint8_t *p, SDataFile *pDataFile) {
|
||||
int32_t n = 0;
|
||||
|
||||
n += tPutI64v(p ? p + n : p, pDataFile->commitID, true);
|
||||
n += tPutI64v(p ? p + n : p, pDataFile->size, true);
|
||||
n += tPutI64v(p ? p + n : p, pDataFile->commitID);
|
||||
n += tPutI64v(p ? p + n : p, pDataFile->size);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -48,8 +48,8 @@ int32_t tPutDataFile(uint8_t *p, SDataFile *pDataFile) {
|
|||
static int32_t tGetDataFile(uint8_t *p, SDataFile *pDataFile) {
|
||||
int32_t n = 0;
|
||||
|
||||
n += tGetI64v(p + n, &pDataFile->commitID, true);
|
||||
n += tGetI64v(p + n, &pDataFile->size, true);
|
||||
n += tGetI64v(p + n, &pDataFile->commitID);
|
||||
n += tGetI64v(p + n, &pDataFile->size);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -57,9 +57,9 @@ static int32_t tGetDataFile(uint8_t *p, SDataFile *pDataFile) {
|
|||
int32_t tPutSttFile(uint8_t *p, SSttFile *pSttFile) {
|
||||
int32_t n = 0;
|
||||
|
||||
n += tPutI64v(p ? p + n : p, pSttFile->commitID, true);
|
||||
n += tPutI64v(p ? p + n : p, pSttFile->size, true);
|
||||
n += tPutI64v(p ? p + n : p, pSttFile->offset, true);
|
||||
n += tPutI64v(p ? p + n : p, pSttFile->commitID);
|
||||
n += tPutI64v(p ? p + n : p, pSttFile->size);
|
||||
n += tPutI64v(p ? p + n : p, pSttFile->offset);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -67,9 +67,9 @@ int32_t tPutSttFile(uint8_t *p, SSttFile *pSttFile) {
|
|||
static int32_t tGetSttFile(uint8_t *p, SSttFile *pSttFile) {
|
||||
int32_t n = 0;
|
||||
|
||||
n += tGetI64v(p + n, &pSttFile->commitID, true);
|
||||
n += tGetI64v(p + n, &pSttFile->size, true);
|
||||
n += tGetI64v(p + n, &pSttFile->offset, true);
|
||||
n += tGetI64v(p + n, &pSttFile->commitID);
|
||||
n += tGetI64v(p + n, &pSttFile->size);
|
||||
n += tGetI64v(p + n, &pSttFile->offset);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -77,8 +77,8 @@ static int32_t tGetSttFile(uint8_t *p, SSttFile *pSttFile) {
|
|||
int32_t tPutSmaFile(uint8_t *p, SSmaFile *pSmaFile) {
|
||||
int32_t n = 0;
|
||||
|
||||
n += tPutI64v(p ? p + n : p, pSmaFile->commitID, true);
|
||||
n += tPutI64v(p ? p + n : p, pSmaFile->size, true);
|
||||
n += tPutI64v(p ? p + n : p, pSmaFile->commitID);
|
||||
n += tPutI64v(p ? p + n : p, pSmaFile->size);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -86,8 +86,8 @@ int32_t tPutSmaFile(uint8_t *p, SSmaFile *pSmaFile) {
|
|||
static int32_t tGetSmaFile(uint8_t *p, SSmaFile *pSmaFile) {
|
||||
int32_t n = 0;
|
||||
|
||||
n += tGetI64v(p + n, &pSmaFile->commitID, true);
|
||||
n += tGetI64v(p + n, &pSmaFile->size, true);
|
||||
n += tGetI64v(p + n, &pSmaFile->commitID);
|
||||
n += tGetI64v(p + n, &pSmaFile->size);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -221,9 +221,9 @@ _err:
|
|||
int32_t tPutDFileSet(uint8_t *p, SDFileSet *pSet) {
|
||||
int32_t n = 0;
|
||||
|
||||
n += tPutI32v(p ? p + n : p, pSet->diskId.level, true);
|
||||
n += tPutI32v(p ? p + n : p, pSet->diskId.id, true);
|
||||
n += tPutI32v(p ? p + n : p, pSet->fid, true);
|
||||
n += tPutI32v(p ? p + n : p, pSet->diskId.level);
|
||||
n += tPutI32v(p ? p + n : p, pSet->diskId.id);
|
||||
n += tPutI32v(p ? p + n : p, pSet->fid);
|
||||
|
||||
// data
|
||||
n += tPutHeadFile(p ? p + n : p, pSet->pHeadF);
|
||||
|
@ -231,7 +231,7 @@ int32_t tPutDFileSet(uint8_t *p, SDFileSet *pSet) {
|
|||
n += tPutSmaFile(p ? p + n : p, pSet->pSmaF);
|
||||
|
||||
// stt
|
||||
n += tPutU8(p ? p + n : p, pSet->nSttF, true);
|
||||
n += tPutU8(p ? p + n : p, pSet->nSttF);
|
||||
for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) {
|
||||
n += tPutSttFile(p ? p + n : p, pSet->aSttF[iStt]);
|
||||
}
|
||||
|
@ -242,9 +242,9 @@ int32_t tPutDFileSet(uint8_t *p, SDFileSet *pSet) {
|
|||
int32_t tGetDFileSet(uint8_t *p, SDFileSet *pSet) {
|
||||
int32_t n = 0;
|
||||
|
||||
n += tGetI32v(p + n, &pSet->diskId.level, true);
|
||||
n += tGetI32v(p + n, &pSet->diskId.id, true);
|
||||
n += tGetI32v(p + n, &pSet->fid, true);
|
||||
n += tGetI32v(p + n, &pSet->diskId.level);
|
||||
n += tGetI32v(p + n, &pSet->diskId.id);
|
||||
n += tGetI32v(p + n, &pSet->fid);
|
||||
|
||||
// head
|
||||
pSet->pHeadF = (SHeadFile *)taosMemoryCalloc(1, sizeof(SHeadFile));
|
||||
|
@ -271,7 +271,7 @@ int32_t tGetDFileSet(uint8_t *p, SDFileSet *pSet) {
|
|||
n += tGetSmaFile(p + n, pSet->pSmaF);
|
||||
|
||||
// stt
|
||||
n += tGetU8(p + n, &pSet->nSttF, true);
|
||||
n += tGetU8(p + n, &pSet->nSttF);
|
||||
for (int32_t iStt = 0; iStt < pSet->nSttF; iStt++) {
|
||||
pSet->aSttF[iStt] = (SSttFile *)taosMemoryCalloc(1, sizeof(SSttFile));
|
||||
if (pSet->aSttF[iStt] == NULL) {
|
||||
|
@ -298,9 +298,9 @@ void tsdbDelFileName(STsdb *pTsdb, SDelFile *pFile, char fname[]) {
|
|||
int32_t tPutDelFile(uint8_t *p, SDelFile *pDelFile) {
|
||||
int32_t n = 0;
|
||||
|
||||
n += tPutI64v(p ? p + n : p, pDelFile->commitID, true);
|
||||
n += tPutI64v(p ? p + n : p, pDelFile->size, true);
|
||||
n += tPutI64v(p ? p + n : p, pDelFile->offset, true);
|
||||
n += tPutI64v(p ? p + n : p, pDelFile->commitID);
|
||||
n += tPutI64v(p ? p + n : p, pDelFile->size);
|
||||
n += tPutI64v(p ? p + n : p, pDelFile->offset);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -308,9 +308,9 @@ int32_t tPutDelFile(uint8_t *p, SDelFile *pDelFile) {
|
|||
int32_t tGetDelFile(uint8_t *p, SDelFile *pDelFile) {
|
||||
int32_t n = 0;
|
||||
|
||||
n += tGetI64v(p + n, &pDelFile->commitID, true);
|
||||
n += tGetI64v(p + n, &pDelFile->size, true);
|
||||
n += tGetI64v(p + n, &pDelFile->offset, true);
|
||||
n += tGetI64v(p + n, &pDelFile->commitID);
|
||||
n += tGetI64v(p + n, &pDelFile->size);
|
||||
n += tGetI64v(p + n, &pDelFile->offset);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
|
|
@ -522,17 +522,17 @@ int32_t tsdbSttFileReadStatisBlock(SSttFileReader *reader, const SStatisBlk *sta
|
|||
|
||||
// decode value columns
|
||||
for (int32_t i = 0; i < statisBlk->numOfPKs; i++) {
|
||||
code = tValueColumnDecompress(tBufferGetDataAt(&reader->buffers[0], size), firstKeyInfos[i].compressedDataSize,
|
||||
code = tValueColumnDecompress(tBufferGetDataAt(&reader->buffers[0], size), firstKeyInfos[i].dataCompressedSize,
|
||||
&firstKeyInfos[i], &statisBlock->firstKeyPKs[i], &reader->buffers[1]);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
size += firstKeyInfos[i].compressedDataSize;
|
||||
size += firstKeyInfos[i].dataCompressedSize;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < statisBlk->numOfPKs; i++) {
|
||||
code = tValueColumnDecompress(tBufferGetDataAt(&reader->buffers[0], size), lastKeyInfos[i].compressedDataSize,
|
||||
code = tValueColumnDecompress(tBufferGetDataAt(&reader->buffers[0], size), lastKeyInfos[i].dataCompressedSize,
|
||||
&lastKeyInfos[i], &statisBlock->lastKeyPKs[i], &reader->buffers[1]);
|
||||
TSDB_CHECK_CODE(code, lino, _exit);
|
||||
size += lastKeyInfos[i].compressedDataSize;
|
||||
size += lastKeyInfos[i].dataCompressedSize;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -151,18 +151,18 @@ int32_t tGetMapData(uint8_t *p, SMapData *pMapData) {
|
|||
|
||||
tMapDataReset(pMapData);
|
||||
|
||||
n += tGetI32v(p + n, &pMapData->nItem, true);
|
||||
n += tGetI32v(p + n, &pMapData->nItem);
|
||||
if (pMapData->nItem) {
|
||||
if (tRealloc((uint8_t **)&pMapData->aOffset, sizeof(int32_t) * pMapData->nItem)) return -1;
|
||||
|
||||
int32_t lOffset = 0;
|
||||
for (int32_t iItem = 0; iItem < pMapData->nItem; iItem++) {
|
||||
n += tGetI32v(p + n, &pMapData->aOffset[iItem], true);
|
||||
n += tGetI32v(p + n, &pMapData->aOffset[iItem]);
|
||||
pMapData->aOffset[iItem] += lOffset;
|
||||
lOffset = pMapData->aOffset[iItem];
|
||||
}
|
||||
|
||||
n += tGetI32v(p + n, &pMapData->nData, true);
|
||||
n += tGetI32v(p + n, &pMapData->nData);
|
||||
if (tRealloc(&pMapData->pData, pMapData->nData)) return -1;
|
||||
memcpy(pMapData->pData, p + n, pMapData->nData);
|
||||
n += pMapData->nData;
|
||||
|
@ -210,10 +210,10 @@ int32_t tGetBlockIdx(uint8_t *p, void *ph) {
|
|||
int32_t n = 0;
|
||||
SBlockIdx *pBlockIdx = (SBlockIdx *)ph;
|
||||
|
||||
n += tGetI64(p + n, &pBlockIdx->suid, true);
|
||||
n += tGetI64(p + n, &pBlockIdx->uid, true);
|
||||
n += tGetI64v(p + n, &pBlockIdx->offset, true);
|
||||
n += tGetI64v(p + n, &pBlockIdx->size, true);
|
||||
n += tGetI64(p + n, &pBlockIdx->suid);
|
||||
n += tGetI64(p + n, &pBlockIdx->uid);
|
||||
n += tGetI64v(p + n, &pBlockIdx->offset);
|
||||
n += tGetI64v(p + n, &pBlockIdx->size);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -293,23 +293,23 @@ int32_t tGetDataBlk(uint8_t *p, void *ph) {
|
|||
int32_t n = 0;
|
||||
SDataBlk *pDataBlk = (SDataBlk *)ph;
|
||||
|
||||
n += tGetI64v(p + n, &pDataBlk->minKey.version, true);
|
||||
n += tGetI64v(p + n, &pDataBlk->minKey.ts, true);
|
||||
n += tGetI64v(p + n, &pDataBlk->maxKey.version, true);
|
||||
n += tGetI64v(p + n, &pDataBlk->maxKey.ts, true);
|
||||
n += tGetI64v(p + n, &pDataBlk->minVer, true);
|
||||
n += tGetI64v(p + n, &pDataBlk->maxVer, true);
|
||||
n += tGetI32v(p + n, &pDataBlk->nRow, true);
|
||||
n += tGetI8(p + n, &pDataBlk->hasDup, true);
|
||||
n += tGetI8(p + n, &pDataBlk->nSubBlock, true);
|
||||
n += tGetI64v(p + n, &pDataBlk->minKey.version);
|
||||
n += tGetI64v(p + n, &pDataBlk->minKey.ts);
|
||||
n += tGetI64v(p + n, &pDataBlk->maxKey.version);
|
||||
n += tGetI64v(p + n, &pDataBlk->maxKey.ts);
|
||||
n += tGetI64v(p + n, &pDataBlk->minVer);
|
||||
n += tGetI64v(p + n, &pDataBlk->maxVer);
|
||||
n += tGetI32v(p + n, &pDataBlk->nRow);
|
||||
n += tGetI8(p + n, &pDataBlk->hasDup);
|
||||
n += tGetI8(p + n, &pDataBlk->nSubBlock);
|
||||
for (int8_t iSubBlock = 0; iSubBlock < pDataBlk->nSubBlock; iSubBlock++) {
|
||||
n += tGetI64v(p + n, &pDataBlk->aSubBlock[iSubBlock].offset, true);
|
||||
n += tGetI32v(p + n, &pDataBlk->aSubBlock[iSubBlock].szBlock, true);
|
||||
n += tGetI32v(p + n, &pDataBlk->aSubBlock[iSubBlock].szKey, true);
|
||||
n += tGetI64v(p + n, &pDataBlk->aSubBlock[iSubBlock].offset);
|
||||
n += tGetI32v(p + n, &pDataBlk->aSubBlock[iSubBlock].szBlock);
|
||||
n += tGetI32v(p + n, &pDataBlk->aSubBlock[iSubBlock].szKey);
|
||||
}
|
||||
if (pDataBlk->nSubBlock == 1 && !pDataBlk->hasDup) {
|
||||
n += tGetI64v(p + n, &pDataBlk->smaInfo.offset, true);
|
||||
n += tGetI32v(p + n, &pDataBlk->smaInfo.size, true);
|
||||
n += tGetI64v(p + n, &pDataBlk->smaInfo.offset);
|
||||
n += tGetI32v(p + n, &pDataBlk->smaInfo.size);
|
||||
} else {
|
||||
pDataBlk->smaInfo.offset = 0;
|
||||
pDataBlk->smaInfo.size = 0;
|
||||
|
@ -364,17 +364,17 @@ int32_t tGetSttBlk(uint8_t *p, void *ph) {
|
|||
int32_t n = 0;
|
||||
SSttBlk *pSttBlk = (SSttBlk *)ph;
|
||||
|
||||
n += tGetI64(p + n, &pSttBlk->suid, true);
|
||||
n += tGetI64(p + n, &pSttBlk->minUid, true);
|
||||
n += tGetI64(p + n, &pSttBlk->maxUid, true);
|
||||
n += tGetI64v(p + n, &pSttBlk->minKey, true);
|
||||
n += tGetI64v(p + n, &pSttBlk->maxKey, true);
|
||||
n += tGetI64v(p + n, &pSttBlk->minVer, true);
|
||||
n += tGetI64v(p + n, &pSttBlk->maxVer, true);
|
||||
n += tGetI32v(p + n, &pSttBlk->nRow, true);
|
||||
n += tGetI64v(p + n, &pSttBlk->bInfo.offset, true);
|
||||
n += tGetI32v(p + n, &pSttBlk->bInfo.szBlock, true);
|
||||
n += tGetI32v(p + n, &pSttBlk->bInfo.szKey, true);
|
||||
n += tGetI64(p + n, &pSttBlk->suid);
|
||||
n += tGetI64(p + n, &pSttBlk->minUid);
|
||||
n += tGetI64(p + n, &pSttBlk->maxUid);
|
||||
n += tGetI64v(p + n, &pSttBlk->minKey);
|
||||
n += tGetI64v(p + n, &pSttBlk->maxKey);
|
||||
n += tGetI64v(p + n, &pSttBlk->minVer);
|
||||
n += tGetI64v(p + n, &pSttBlk->maxVer);
|
||||
n += tGetI32v(p + n, &pSttBlk->nRow);
|
||||
n += tGetI64v(p + n, &pSttBlk->bInfo.offset);
|
||||
n += tGetI32v(p + n, &pSttBlk->bInfo.szBlock);
|
||||
n += tGetI32v(p + n, &pSttBlk->bInfo.szKey);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -386,26 +386,26 @@ int32_t tPutBlockCol(uint8_t *p, void *ph) {
|
|||
|
||||
ASSERT(pBlockCol->flag && (pBlockCol->flag != HAS_NONE));
|
||||
|
||||
n += tPutI16v(p ? p + n : p, pBlockCol->cid, true);
|
||||
n += tPutI8(p ? p + n : p, pBlockCol->type, true);
|
||||
n += tPutI8(p ? p + n : p, pBlockCol->cflag, true);
|
||||
n += tPutI8(p ? p + n : p, pBlockCol->flag, true);
|
||||
n += tPutI32v(p ? p + n : p, pBlockCol->szOrigin, true);
|
||||
n += tPutI16v(p ? p + n : p, pBlockCol->cid);
|
||||
n += tPutI8(p ? p + n : p, pBlockCol->type);
|
||||
n += tPutI8(p ? p + n : p, pBlockCol->cflag);
|
||||
n += tPutI8(p ? p + n : p, pBlockCol->flag);
|
||||
n += tPutI32v(p ? p + n : p, pBlockCol->szOrigin);
|
||||
|
||||
if (pBlockCol->flag != HAS_NULL) {
|
||||
if (pBlockCol->flag != HAS_VALUE) {
|
||||
n += tPutI32v(p ? p + n : p, pBlockCol->szBitmap, true);
|
||||
n += tPutI32v(p ? p + n : p, pBlockCol->szBitmap);
|
||||
}
|
||||
|
||||
if (IS_VAR_DATA_TYPE(pBlockCol->type)) {
|
||||
n += tPutI32v(p ? p + n : p, pBlockCol->szOffset, true);
|
||||
n += tPutI32v(p ? p + n : p, pBlockCol->szOffset);
|
||||
}
|
||||
|
||||
if (pBlockCol->flag != (HAS_NULL | HAS_NONE)) {
|
||||
n += tPutI32v(p ? p + n : p, pBlockCol->szValue, true);
|
||||
n += tPutI32v(p ? p + n : p, pBlockCol->szValue);
|
||||
}
|
||||
|
||||
n += tPutI32v(p ? p + n : p, pBlockCol->offset, true);
|
||||
n += tPutI32v(p ? p + n : p, pBlockCol->offset);
|
||||
}
|
||||
|
||||
_exit:
|
||||
|
@ -416,11 +416,11 @@ int32_t tGetBlockCol(uint8_t *p, void *ph) {
|
|||
int32_t n = 0;
|
||||
SBlockCol *pBlockCol = (SBlockCol *)ph;
|
||||
|
||||
n += tGetI16v(p + n, &pBlockCol->cid, true);
|
||||
n += tGetI8(p + n, &pBlockCol->type, true);
|
||||
n += tGetI8(p + n, &pBlockCol->cflag, true);
|
||||
n += tGetI8(p + n, &pBlockCol->flag, true);
|
||||
n += tGetI32v(p + n, &pBlockCol->szOrigin, true);
|
||||
n += tGetI16v(p + n, &pBlockCol->cid);
|
||||
n += tGetI8(p + n, &pBlockCol->type);
|
||||
n += tGetI8(p + n, &pBlockCol->cflag);
|
||||
n += tGetI8(p + n, &pBlockCol->flag);
|
||||
n += tGetI32v(p + n, &pBlockCol->szOrigin);
|
||||
|
||||
ASSERT(pBlockCol->flag && (pBlockCol->flag != HAS_NONE));
|
||||
|
||||
|
@ -431,18 +431,18 @@ int32_t tGetBlockCol(uint8_t *p, void *ph) {
|
|||
|
||||
if (pBlockCol->flag != HAS_NULL) {
|
||||
if (pBlockCol->flag != HAS_VALUE) {
|
||||
n += tGetI32v(p + n, &pBlockCol->szBitmap, true);
|
||||
n += tGetI32v(p + n, &pBlockCol->szBitmap);
|
||||
}
|
||||
|
||||
if (IS_VAR_DATA_TYPE(pBlockCol->type)) {
|
||||
n += tGetI32v(p + n, &pBlockCol->szOffset, true);
|
||||
n += tGetI32v(p + n, &pBlockCol->szOffset);
|
||||
}
|
||||
|
||||
if (pBlockCol->flag != (HAS_NULL | HAS_NONE)) {
|
||||
n += tGetI32v(p + n, &pBlockCol->szValue, true);
|
||||
n += tGetI32v(p + n, &pBlockCol->szValue);
|
||||
}
|
||||
|
||||
n += tGetI32v(p + n, &pBlockCol->offset, true);
|
||||
n += tGetI32v(p + n, &pBlockCol->offset);
|
||||
}
|
||||
|
||||
return n;
|
||||
|
@ -496,10 +496,10 @@ int32_t tGetDelIdx(uint8_t *p, void *ph) {
|
|||
SDelIdx *pDelIdx = (SDelIdx *)ph;
|
||||
int32_t n = 0;
|
||||
|
||||
n += tGetI64(p + n, &pDelIdx->suid, true);
|
||||
n += tGetI64(p + n, &pDelIdx->uid, true);
|
||||
n += tGetI64v(p + n, &pDelIdx->offset, true);
|
||||
n += tGetI64v(p + n, &pDelIdx->size, true);
|
||||
n += tGetI64(p + n, &pDelIdx->suid);
|
||||
n += tGetI64(p + n, &pDelIdx->uid);
|
||||
n += tGetI64v(p + n, &pDelIdx->offset);
|
||||
n += tGetI64v(p + n, &pDelIdx->size);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -522,9 +522,9 @@ int32_t tGetDelData(uint8_t *p, void *ph) {
|
|||
SDelData *pDelData = (SDelData *)ph;
|
||||
int32_t n = 0;
|
||||
|
||||
n += tGetI64v(p + n, &pDelData->version, true);
|
||||
n += tGetI64(p + n, &pDelData->sKey, true);
|
||||
n += tGetI64(p + n, &pDelData->eKey, true);
|
||||
n += tGetI64v(p + n, &pDelData->version);
|
||||
n += tGetI64(p + n, &pDelData->sKey);
|
||||
n += tGetI64(p + n, &pDelData->eKey);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -1595,18 +1595,18 @@ _exit:
|
|||
int32_t tPutDiskDataHdr(uint8_t *p, const SDiskDataHdr *pHdr) {
|
||||
int32_t n = 0;
|
||||
|
||||
n += tPutU32(p ? p + n : p, pHdr->delimiter, true);
|
||||
n += tPutU32v(p ? p + n : p, pHdr->fmtVer, true);
|
||||
n += tPutI64(p ? p + n : p, pHdr->suid, true);
|
||||
n += tPutI64(p ? p + n : p, pHdr->uid, true);
|
||||
n += tPutI32v(p ? p + n : p, pHdr->szUid, true);
|
||||
n += tPutI32v(p ? p + n : p, pHdr->szVer, true);
|
||||
n += tPutI32v(p ? p + n : p, pHdr->szKey, true);
|
||||
n += tPutI32v(p ? p + n : p, pHdr->szBlkCol, true);
|
||||
n += tPutI32v(p ? p + n : p, pHdr->nRow, true);
|
||||
n += tPutI8(p ? p + n : p, pHdr->cmprAlg, true);
|
||||
n += tPutU32(p ? p + n : p, pHdr->delimiter);
|
||||
n += tPutU32v(p ? p + n : p, pHdr->fmtVer);
|
||||
n += tPutI64(p ? p + n : p, pHdr->suid);
|
||||
n += tPutI64(p ? p + n : p, pHdr->uid);
|
||||
n += tPutI32v(p ? p + n : p, pHdr->szUid);
|
||||
n += tPutI32v(p ? p + n : p, pHdr->szVer);
|
||||
n += tPutI32v(p ? p + n : p, pHdr->szKey);
|
||||
n += tPutI32v(p ? p + n : p, pHdr->szBlkCol);
|
||||
n += tPutI32v(p ? p + n : p, pHdr->nRow);
|
||||
n += tPutI8(p ? p + n : p, pHdr->cmprAlg);
|
||||
if (pHdr->fmtVer == 1) {
|
||||
n += tPutI8(p ? p + n : p, pHdr->numPrimaryKeyCols, true);
|
||||
n += tPutI8(p ? p + n : p, pHdr->numPrimaryKeyCols);
|
||||
}
|
||||
|
||||
return n;
|
||||
|
@ -1616,18 +1616,18 @@ int32_t tGetDiskDataHdr(uint8_t *p, void *ph) {
|
|||
int32_t n = 0;
|
||||
SDiskDataHdr *pHdr = (SDiskDataHdr *)ph;
|
||||
|
||||
n += tGetU32(p + n, &pHdr->delimiter, true);
|
||||
n += tGetU32v(p + n, &pHdr->fmtVer, true);
|
||||
n += tGetI64(p + n, &pHdr->suid, true);
|
||||
n += tGetI64(p + n, &pHdr->uid, true);
|
||||
n += tGetI32v(p + n, &pHdr->szUid, true);
|
||||
n += tGetI32v(p + n, &pHdr->szVer, true);
|
||||
n += tGetI32v(p + n, &pHdr->szKey, true);
|
||||
n += tGetI32v(p + n, &pHdr->szBlkCol, true);
|
||||
n += tGetI32v(p + n, &pHdr->nRow, true);
|
||||
n += tGetI8(p + n, &pHdr->cmprAlg, true);
|
||||
n += tGetU32(p + n, &pHdr->delimiter);
|
||||
n += tGetU32v(p + n, &pHdr->fmtVer);
|
||||
n += tGetI64(p + n, &pHdr->suid);
|
||||
n += tGetI64(p + n, &pHdr->uid);
|
||||
n += tGetI32v(p + n, &pHdr->szUid);
|
||||
n += tGetI32v(p + n, &pHdr->szVer);
|
||||
n += tGetI32v(p + n, &pHdr->szKey);
|
||||
n += tGetI32v(p + n, &pHdr->szBlkCol);
|
||||
n += tGetI32v(p + n, &pHdr->nRow);
|
||||
n += tGetI8(p + n, &pHdr->cmprAlg);
|
||||
if (pHdr->fmtVer == 1) {
|
||||
n += tGetI8(p + n, &pHdr->numPrimaryKeyCols, true);
|
||||
n += tGetI8(p + n, &pHdr->numPrimaryKeyCols);
|
||||
} else {
|
||||
pHdr->numPrimaryKeyCols = 0;
|
||||
}
|
||||
|
@ -1639,11 +1639,11 @@ int32_t tGetDiskDataHdr(uint8_t *p, void *ph) {
|
|||
int32_t tPutColumnDataAgg(uint8_t *p, SColumnDataAgg *pColAgg) {
|
||||
int32_t n = 0;
|
||||
|
||||
n += tPutI16v(p ? p + n : p, pColAgg->colId, true);
|
||||
n += tPutI16v(p ? p + n : p, pColAgg->numOfNull, true);
|
||||
n += tPutI64(p ? p + n : p, pColAgg->sum, true);
|
||||
n += tPutI64(p ? p + n : p, pColAgg->max, true);
|
||||
n += tPutI64(p ? p + n : p, pColAgg->min, true);
|
||||
n += tPutI16v(p ? p + n : p, pColAgg->colId);
|
||||
n += tPutI16v(p ? p + n : p, pColAgg->numOfNull);
|
||||
n += tPutI64(p ? p + n : p, pColAgg->sum);
|
||||
n += tPutI64(p ? p + n : p, pColAgg->max);
|
||||
n += tPutI64(p ? p + n : p, pColAgg->min);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -1651,11 +1651,11 @@ int32_t tPutColumnDataAgg(uint8_t *p, SColumnDataAgg *pColAgg) {
|
|||
int32_t tGetColumnDataAgg(uint8_t *p, SColumnDataAgg *pColAgg) {
|
||||
int32_t n = 0;
|
||||
|
||||
n += tGetI16v(p + n, &pColAgg->colId, true);
|
||||
n += tGetI16v(p + n, &pColAgg->numOfNull, true);
|
||||
n += tGetI64(p + n, &pColAgg->sum, true);
|
||||
n += tGetI64(p + n, &pColAgg->max, true);
|
||||
n += tGetI64(p + n, &pColAgg->min, true);
|
||||
n += tGetI16v(p + n, &pColAgg->colId);
|
||||
n += tGetI16v(p + n, &pColAgg->numOfNull);
|
||||
n += tGetI64(p + n, &pColAgg->sum);
|
||||
n += tGetI64(p + n, &pColAgg->max);
|
||||
n += tGetI64(p + n, &pColAgg->min);
|
||||
|
||||
return n;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue