more work
This commit is contained in:
parent
996ded1944
commit
6211f28102
|
@ -42,6 +42,8 @@ int32_t tTSchemaCreate(int32_t sver, SSchema *pSchema, int32_t nCols, STSchema *
|
||||||
void tTSchemaDestroy(STSchema *pTSchema);
|
void tTSchemaDestroy(STSchema *pTSchema);
|
||||||
|
|
||||||
// SValue
|
// SValue
|
||||||
|
int32_t tPutValue(uint8_t *p, SValue *pValue, int8_t type);
|
||||||
|
int32_t tGetValue(uint8_t *p, SValue *pValue, int8_t type);
|
||||||
int tValueCmprFn(const SValue *pValue1, const SValue *pValue2, int8_t type);
|
int tValueCmprFn(const SValue *pValue1, const SValue *pValue2, int8_t type);
|
||||||
|
|
||||||
// STSRow2
|
// STSRow2
|
||||||
|
|
|
@ -37,7 +37,7 @@ typedef struct {
|
||||||
#define GET_BIT2(p, i) (((p)[(i) / 4] >> ((i) % 4)) & ((uint8_t)3))
|
#define GET_BIT2(p, i) (((p)[(i) / 4] >> ((i) % 4)) & ((uint8_t)3))
|
||||||
|
|
||||||
// SValue
|
// SValue
|
||||||
static FORCE_INLINE int32_t tPutValue(uint8_t *p, SValue *pValue, int8_t type) {
|
int32_t tPutValue(uint8_t *p, SValue *pValue, int8_t type) {
|
||||||
int32_t n = 0;
|
int32_t n = 0;
|
||||||
|
|
||||||
if (IS_VAR_DATA_TYPE(type)) {
|
if (IS_VAR_DATA_TYPE(type)) {
|
||||||
|
@ -88,7 +88,7 @@ static FORCE_INLINE int32_t tPutValue(uint8_t *p, SValue *pValue, int8_t type) {
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
static FORCE_INLINE int32_t tGetValue(uint8_t *p, SValue *pValue, int8_t type) {
|
int32_t tGetValue(uint8_t *p, SValue *pValue, int8_t type) {
|
||||||
int32_t n = 0;
|
int32_t n = 0;
|
||||||
|
|
||||||
if (IS_VAR_DATA_TYPE(type)) {
|
if (IS_VAR_DATA_TYPE(type)) {
|
||||||
|
|
|
@ -46,7 +46,8 @@ typedef struct SMergeInfo SMergeInfo;
|
||||||
typedef struct STable STable;
|
typedef struct STable STable;
|
||||||
typedef struct SOffset SOffset;
|
typedef struct SOffset SOffset;
|
||||||
typedef struct SMapData SMapData;
|
typedef struct SMapData SMapData;
|
||||||
typedef struct SVDataCols SVDataCols;
|
typedef struct SColData SColData;
|
||||||
|
typedef struct SColDataBlock SColDataBlock;
|
||||||
|
|
||||||
// tsdbMemTable ==============================================================================================
|
// tsdbMemTable ==============================================================================================
|
||||||
|
|
||||||
|
@ -270,8 +271,16 @@ int tsdbLockRepo(STsdb *pTsdb);
|
||||||
int tsdbUnlockRepo(STsdb *pTsdb);
|
int tsdbUnlockRepo(STsdb *pTsdb);
|
||||||
|
|
||||||
struct TSDBROW {
|
struct TSDBROW {
|
||||||
|
union {
|
||||||
|
struct {
|
||||||
int64_t version;
|
int64_t version;
|
||||||
STSRow *pTSRow;
|
STSRow *pTSRow;
|
||||||
|
};
|
||||||
|
struct {
|
||||||
|
SColDataBlock *pColDataBlock;
|
||||||
|
int32_t iRow;
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SBlockIdxItem {
|
struct SBlockIdxItem {
|
||||||
|
@ -449,8 +458,19 @@ struct SMapData {
|
||||||
uint8_t *pData;
|
uint8_t *pData;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SVDataCols {
|
struct SColData {
|
||||||
|
int16_t cid;
|
||||||
|
uint8_t flags;
|
||||||
|
uint32_t nData;
|
||||||
|
uint8_t *pData;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SColDataBlock {
|
||||||
|
int32_t nRow;
|
||||||
int64_t *aVersion;
|
int64_t *aVersion;
|
||||||
|
TSKEY *aTSKey;
|
||||||
|
int32_t nColData;
|
||||||
|
SColData *aColData;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
|
@ -40,8 +40,8 @@ struct SCommitter {
|
||||||
SBlockIdx *pBlockIdx;
|
SBlockIdx *pBlockIdx;
|
||||||
SMapData oBlock;
|
SMapData oBlock;
|
||||||
SMapData nBlock;
|
SMapData nBlock;
|
||||||
SColDataBatch oBatch;
|
SColDataBlock oColDataBlock;
|
||||||
SColDataBatch nBatch;
|
SColDataBlock nColDataBlock;
|
||||||
/* commit del */
|
/* commit del */
|
||||||
SDelFReader *pDelFReader;
|
SDelFReader *pDelFReader;
|
||||||
SDelFWriter *pDelFWriter;
|
SDelFWriter *pDelFWriter;
|
||||||
|
|
|
@ -726,4 +726,41 @@ int32_t tsdbKeyFid(TSKEY key, int32_t minutes, int8_t precision) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TSDBROW ======================================================
|
||||||
|
void tsdbRowGetColVal(TSDBROW *pRow, STSchema *pTSchema, int32_t iCol, SColVal *pColVal) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
// SColDataBlock ======================================================
|
// SColDataBlock ======================================================
|
||||||
|
int32_t tsdbColDataBlockAppend(SColDataBlock *pColDataBlock, TSDBROW *pRow, STSchema *pTSchema) {
|
||||||
|
int32_t code = 0;
|
||||||
|
int32_t nRow = pColDataBlock->nRow;
|
||||||
|
STColumn *pTColumn;
|
||||||
|
SColData *pColData;
|
||||||
|
SColVal colVal;
|
||||||
|
|
||||||
|
pColDataBlock->nRow++;
|
||||||
|
|
||||||
|
// version
|
||||||
|
pColDataBlock->aVersion[nRow] = pRow->version; // TODO
|
||||||
|
|
||||||
|
// ts
|
||||||
|
pColDataBlock->aTSKey[nRow] = pRow->pTSRow->ts; // TODO
|
||||||
|
|
||||||
|
// other rows
|
||||||
|
for (int32_t iCol = 1; iCol < pTSchema->numOfCols; iCol++) {
|
||||||
|
pTColumn = &pTSchema->columns[iCol];
|
||||||
|
|
||||||
|
tsdbRowGetColVal(pRow, pTSchema, iCol, &colVal);
|
||||||
|
|
||||||
|
if (colVal.isNone) {
|
||||||
|
// TODO
|
||||||
|
} else if (colVal.isNull) {
|
||||||
|
// TODO
|
||||||
|
} else {
|
||||||
|
pColData->nData += tPutValue(pColData->pData + pColData->nData, &colVal.value, pTColumn->type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return code;
|
||||||
|
}
|
Loading…
Reference in New Issue