refact: data format

This commit is contained in:
Hongze Cheng 2022-05-11 02:37:52 +00:00
parent ac27d62f33
commit 89e8f14a79
2 changed files with 21 additions and 8 deletions

View File

@ -41,8 +41,8 @@ int32_t tEncodeTSRow(SEncoder *pEncoder, const STSRow2 *pRow);
int32_t tDecodeTSRow(SDecoder *pDecoder, STSRow2 *pRow);
// STSchema
int32_t tTSchemaCreate(STSchema **ppTSchema);
int32_t tTSchemaDestroy(STSchema *pTSchema);
int32_t tTSchemaCreate(int32_t sver, SSchema *pSchema, int32_t ncols, STSchema **ppTSchema);
void tTSchemaDestroy(STSchema *pTSchema);
// STRUCT =================
struct STColumn {
@ -55,8 +55,8 @@ struct STColumn {
struct STSchema {
int32_t numOfCols;
schema_ver_t version;
uint16_t flen;
int32_t version;
int32_t flen;
int32_t vlen;
int32_t tlen;
STColumn columns[];

View File

@ -43,6 +43,19 @@ int32_t tDecodeTSRow(SDecoder *pDecoder, STSRow2 *pRow) {
return 0;
}
int32_t tTSchemaCreate(int32_t sver, SSchema *pSchema, int32_t ncols, STSchema **ppTSchema) {
*ppTSchema = (STSchema *)taosMemoryMalloc(sizeof(STSchema) + sizeof(STColumn) * ncols);
if (*ppTSchema == NULL) {
terrno = TSDB_CODE_OUT_OF_MEMORY;
return -1;
}
// (*ppTSchema)
return 0;
}
void tTSchemaDestroy(STSchema *pTSchema) { taosMemoryFree(pTSchema); }
#if 1 // ====================
static void dataColSetNEleNull(SDataCol *pCol, int nEle);
int tdAllocMemForCol(SDataCol *pCol, int maxPoints) {