more code
This commit is contained in:
parent
00b0a46060
commit
a881103c86
|
@ -201,8 +201,10 @@ int32_t tColDataSortMerge(SArray **arr);
|
|||
int32_t tColDataAddValueByDataBlock(SColData *pColData, int8_t type, int32_t bytes, int32_t nRows, char *lengthOrbitmap,
|
||||
char *data);
|
||||
// for encode/decode
|
||||
int32_t tPutColData(uint8_t version, SEncoder *pEncoder, SColData *pColData);
|
||||
int32_t tGetColData(uint8_t version, SDecoder *pDecoder, SColData *pColData);
|
||||
int32_t tEncodeColData(uint8_t version, SEncoder *pEncoder, SColData *pColData);
|
||||
int32_t tDecodeColData(uint8_t version, SDecoder *pDecoder, SColData *pColData);
|
||||
int32_t tEncodeRow(SEncoder *pEncoder, SRow *pRow);
|
||||
int32_t tDecodeRow(SDecoder *pDecoder, SRow **ppRow);
|
||||
|
||||
// STRUCT ================================
|
||||
struct STColumn {
|
||||
|
|
|
@ -11639,15 +11639,14 @@ static int32_t tEncodeSSubmitTbData(SEncoder *pCoder, const SSubmitTbData *pSubm
|
|||
TAOS_CHECK_EXIT(tEncodeU64v(pCoder, nColData));
|
||||
|
||||
for (uint64_t i = 0; i < nColData; i++) {
|
||||
tPutColData(SUBMIT_REQUEST_VERSION, pCoder, &aColData[i]);
|
||||
TAOS_CHECK_EXIT(tEncodeColData(SUBMIT_REQUEST_VERSION, pCoder, &aColData[i]));
|
||||
}
|
||||
} else {
|
||||
TAOS_CHECK_EXIT(tEncodeU64v(pCoder, TARRAY_SIZE(pSubmitTbData->aRowP)));
|
||||
|
||||
SRow **rows = (SRow **)TARRAY_DATA(pSubmitTbData->aRowP);
|
||||
for (int32_t iRow = 0; iRow < TARRAY_SIZE(pSubmitTbData->aRowP); ++iRow) {
|
||||
if (pCoder->data) memcpy(pCoder->data + pCoder->pos, rows[iRow], rows[iRow]->len);
|
||||
pCoder->pos += rows[iRow]->len;
|
||||
TAOS_CHECK_EXIT(tEncodeFixed(pCoder, rows[iRow], rows[iRow]->len));
|
||||
}
|
||||
}
|
||||
TAOS_CHECK_EXIT(tEncodeI64(pCoder, pSubmitTbData->ctimeMs));
|
||||
|
@ -11694,7 +11693,7 @@ static int32_t tDecodeSSubmitTbData(SDecoder *pCoder, SSubmitTbData *pSubmitTbDa
|
|||
}
|
||||
|
||||
for (int32_t i = 0; i < nColData; ++i) {
|
||||
tGetColData(version, pCoder, taosArrayReserve(pSubmitTbData->aCol, 1));
|
||||
TAOS_CHECK_EXIT(tDecodeColData(version, pCoder, taosArrayReserve(pSubmitTbData->aCol, 1)));
|
||||
}
|
||||
} else {
|
||||
uint64_t nRow;
|
||||
|
@ -11711,8 +11710,7 @@ static int32_t tDecodeSSubmitTbData(SDecoder *pCoder, SSubmitTbData *pSubmitTbDa
|
|||
TAOS_CHECK_EXIT(terrno);
|
||||
}
|
||||
|
||||
*ppRow = (SRow *)(pCoder->data + pCoder->pos);
|
||||
pCoder->pos += (*ppRow)->len;
|
||||
TAOS_CHECK_EXIT(tDecodeRow(pCoder, ppRow));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3689,7 +3689,7 @@ _exit:
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int32_t tPutColDataVersion0(SEncoder *pEncoder, SColData *pColData) {
|
||||
static int32_t tEncodeColDataVersion0(SEncoder *pEncoder, SColData *pColData) {
|
||||
int32_t code = 0;
|
||||
|
||||
if ((code = tEncodeI16v(pEncoder, pColData->cid))) return code;
|
||||
|
@ -3733,7 +3733,7 @@ static int32_t tPutColDataVersion0(SEncoder *pEncoder, SColData *pColData) {
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t tGetColDataVersion0(SDecoder *pDecoder, SColData *pColData) {
|
||||
static int32_t tDecodeColDataVersion0(SDecoder *pDecoder, SColData *pColData) {
|
||||
int32_t code = 0;
|
||||
|
||||
if ((code = tDecodeI16v(pDecoder, &pColData->cid))) return code;
|
||||
|
@ -3783,40 +3783,54 @@ static int32_t tGetColDataVersion0(SDecoder *pDecoder, SColData *pColData) {
|
|||
return code;
|
||||
}
|
||||
|
||||
static int32_t tPutColDataVersion1(SEncoder *pEncoder, SColData *pColData) {
|
||||
int32_t code = tPutColDataVersion0(pEncoder, pColData);
|
||||
static int32_t tEncodeColDataVersion1(SEncoder *pEncoder, SColData *pColData) {
|
||||
int32_t code = tEncodeColDataVersion0(pEncoder, pColData);
|
||||
if (code) return code;
|
||||
return tEncodeI8(pEncoder, pColData->cflag);
|
||||
}
|
||||
|
||||
static int32_t tGetColDataVersion1(SDecoder *pDecoder, SColData *pColData) {
|
||||
int32_t code = tGetColDataVersion0(pDecoder, pColData);
|
||||
static int32_t tDecodeColDataVersion1(SDecoder *pDecoder, SColData *pColData) {
|
||||
int32_t code = tDecodeColDataVersion0(pDecoder, pColData);
|
||||
if (code) return code;
|
||||
|
||||
code = tDecodeI8(pDecoder, &pColData->cflag);
|
||||
return code;
|
||||
}
|
||||
|
||||
int32_t tPutColData(uint8_t version, SEncoder *pEncoder, SColData *pColData) {
|
||||
int32_t tEncodeColData(uint8_t version, SEncoder *pEncoder, SColData *pColData) {
|
||||
if (version == 0) {
|
||||
return tPutColDataVersion0(pEncoder, pColData);
|
||||
return tEncodeColDataVersion0(pEncoder, pColData);
|
||||
} else if (version == 1) {
|
||||
return tPutColDataVersion1(pEncoder, pColData);
|
||||
return tEncodeColDataVersion1(pEncoder, pColData);
|
||||
} else {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t tGetColData(uint8_t version, SDecoder *pDecoder, SColData *pColData) {
|
||||
int32_t tDecodeColData(uint8_t version, SDecoder *pDecoder, SColData *pColData) {
|
||||
if (version == 0) {
|
||||
return tGetColDataVersion0(pDecoder, pColData);
|
||||
return tDecodeColDataVersion0(pDecoder, pColData);
|
||||
} else if (version == 1) {
|
||||
return tGetColDataVersion1(pDecoder, pColData);
|
||||
return tDecodeColDataVersion1(pDecoder, pColData);
|
||||
} else {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
}
|
||||
|
||||
int32_t tEncodeRow(SEncoder *pEncoder, SRow *pRow) { return tEncodeFixed(pEncoder, pRow, pRow->len); }
|
||||
|
||||
int32_t tDecodeRow(SDecoder *pDecoder, SRow **ppRow) {
|
||||
if (ppRow == NULL) {
|
||||
return TSDB_CODE_INVALID_PARA;
|
||||
}
|
||||
|
||||
if (pDecoder->pos + sizeof(SRow) > pDecoder->size) {
|
||||
return TSDB_CODE_OUT_OF_RANGE;
|
||||
}
|
||||
|
||||
return tDecodeBinaryWithSize(pDecoder, ((SRow *)(pDecoder->data + pDecoder->pos))->len, (uint8_t **)ppRow);
|
||||
}
|
||||
|
||||
#define CALC_SUM_MAX_MIN(SUM, MAX, MIN, VAL) \
|
||||
do { \
|
||||
(SUM) += (VAL); \
|
||||
|
|
|
@ -318,7 +318,7 @@ static int32_t vnodePreProcessSubmitTbData(SVnode *pVnode, SDecoder *pCoder, int
|
|||
}
|
||||
|
||||
SColData colData = {0};
|
||||
tGetColData(version, pCoder, &colData);
|
||||
tDecodeColData(version, pCoder, &colData);
|
||||
if (colData.flag != HAS_VALUE) {
|
||||
code = TSDB_CODE_INVALID_MSG;
|
||||
goto _exit;
|
||||
|
@ -332,7 +332,7 @@ static int32_t vnodePreProcessSubmitTbData(SVnode *pVnode, SDecoder *pCoder, int
|
|||
}
|
||||
|
||||
for (uint64_t i = 1; i < nColData; i++) {
|
||||
tGetColData(version, pCoder, &colData);
|
||||
tDecodeColData(version, pCoder, &colData);
|
||||
}
|
||||
} else {
|
||||
uint64_t nRow;
|
||||
|
|
Loading…
Reference in New Issue