提交 61e21ebf 编写于 作者: H Hongze Cheng

feat: tag refact

上级 65bdd340
......@@ -18,6 +18,7 @@
#include "os.h"
#include "talgo.h"
#include "tarray.h"
#include "tencode.h"
#include "ttypes.h"
#include "tutil.h"
......@@ -64,7 +65,7 @@ void tTagFree(STag *pTag);
void tTagGet(STag *pTag, STagVal *pTagVal);
int32_t tEncodeTag(SEncoder *pEncoder, const STag *pTag);
int32_t tDecodeTag(SDecoder *pDecoder, STag **ppTag);
int32_t tTagToValArray(STag *pTag, STagVal **ppTagVals, int16_t *nTag);
int32_t tTagToValArray(STag *pTag, SArray **ppArray);
// STRUCT =================
struct STColumn {
......
......@@ -671,19 +671,20 @@ int32_t tEncodeTag(SEncoder *pEncoder, const STag *pTag) {
int32_t tDecodeTag(SDecoder *pDecoder, STag **ppTag) { return tDecodeBinary(pDecoder, (uint8_t **)ppTag, NULL); }
int32_t tTagToValArray(STag *pTag, STagVal **ppTagVals, int16_t *nTag) {
int32_t tTagToValArray(STag *pTag, SArray **ppArray) {
int32_t code = 0;
uint8_t *p = (uint8_t *)&pTag->idx[pTag->nTag];
STagVal tv;
*nTag = pTag->nTag;
(*ppTagVals) = (STagVal *)taosMemoryMalloc(sizeof(STagVal) * pTag->nTag);
if (*ppTagVals == NULL) {
(*ppArray) = taosArrayInit(pTag->nTag, sizeof(STagVal));
if (*ppArray == NULL) {
code = TSDB_CODE_OUT_OF_MEMORY;
goto _err;
}
for (int16_t iTag = 0; iTag < pTag->nTag; iTag++) {
tGetTagVal(p + pTag->idx[iTag], &(*ppTagVals)[iTag], pTag->isJson);
tGetTagVal(p + pTag->idx[iTag], &tv, pTag->isJson);
taosArrayPush(*ppArray, &tv);
}
return code;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册