more work
This commit is contained in:
parent
6a50b2b483
commit
7b353b5709
|
@ -81,7 +81,7 @@ void tsdbRowGetColVal(TSDBROW *pRow, STSchema *pTSchema, int32_t iCol, SColVa
|
||||||
int32_t tPutTSDBRow(uint8_t *p, TSDBROW *pRow);
|
int32_t tPutTSDBRow(uint8_t *p, TSDBROW *pRow);
|
||||||
int32_t tGetTSDBRow(uint8_t *p, TSDBROW *pRow);
|
int32_t tGetTSDBRow(uint8_t *p, TSDBROW *pRow);
|
||||||
// SRowIter
|
// SRowIter
|
||||||
#define tRowIterInit(ROW, SCHEMA) ((SRowIter){.pRow = (ROW), .pSchema = (SCHEMA)})
|
void tRowIterInit(SRowIter *pIter, TSDBROW *pRow, STSchema *pTSchema);
|
||||||
SColVal *tRowIterNext(SRowIter *pIter);
|
SColVal *tRowIterNext(SRowIter *pIter);
|
||||||
// TABLEID
|
// TABLEID
|
||||||
int32_t tTABLEIDCmprFn(const void *p1, const void *p2);
|
int32_t tTABLEIDCmprFn(const void *p1, const void *p2);
|
||||||
|
@ -114,6 +114,7 @@ int32_t tGetBlockIdx(uint8_t *p, void *ph);
|
||||||
void tColDataReset(SColData *pColData);
|
void tColDataReset(SColData *pColData);
|
||||||
void tColDataClear(void *ph);
|
void tColDataClear(void *ph);
|
||||||
int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal);
|
int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal);
|
||||||
|
void tColDataGetValue(SColData *pColData, int32_t iRow, SColVal *pColVal);
|
||||||
int32_t tColDataCmprFn(const void *p1, const void *p2);
|
int32_t tColDataCmprFn(const void *p1, const void *p2);
|
||||||
// SBlockData
|
// SBlockData
|
||||||
int32_t tBlockDataInit(SBlockData *pBlockData);
|
int32_t tBlockDataInit(SBlockData *pBlockData);
|
||||||
|
@ -449,22 +450,26 @@ struct SBlockDataHdr {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SHeadFile {
|
struct SHeadFile {
|
||||||
|
int64_t commitID;
|
||||||
int64_t size;
|
int64_t size;
|
||||||
int64_t offset;
|
int64_t offset;
|
||||||
int32_t nRef;
|
int32_t nRef;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SDataFile {
|
struct SDataFile {
|
||||||
|
int64_t commitID;
|
||||||
int64_t size;
|
int64_t size;
|
||||||
int32_t nRef;
|
int32_t nRef;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SLastFile {
|
struct SLastFile {
|
||||||
|
int64_t commitID;
|
||||||
int64_t size;
|
int64_t size;
|
||||||
int32_t nRef;
|
int32_t nRef;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SSmaFile {
|
struct SSmaFile {
|
||||||
|
int64_t commitID;
|
||||||
int64_t size;
|
int64_t size;
|
||||||
int32_t nRef;
|
int32_t nRef;
|
||||||
};
|
};
|
||||||
|
@ -481,7 +486,7 @@ struct SDFileSet {
|
||||||
|
|
||||||
struct SRowIter {
|
struct SRowIter {
|
||||||
TSDBROW *pRow;
|
TSDBROW *pRow;
|
||||||
STSchema *pSchema;
|
STSchema *pTSchema;
|
||||||
SColVal colVal;
|
SColVal colVal;
|
||||||
int32_t i;
|
int32_t i;
|
||||||
};
|
};
|
||||||
|
|
|
@ -583,6 +583,43 @@ int32_t tGetTSDBRow(uint8_t *p, TSDBROW *pRow) {
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SRowIter ======================================================
|
||||||
|
void tRowIterInit(SRowIter *pIter, TSDBROW *pRow, STSchema *pTSchema) {
|
||||||
|
pIter->pRow = pRow;
|
||||||
|
if (pRow->type == 0) {
|
||||||
|
ASSERT(pTSchema);
|
||||||
|
pIter->pTSchema = pTSchema;
|
||||||
|
pIter->i = 1;
|
||||||
|
} else if (pRow->type == 1) {
|
||||||
|
pIter->pTSchema = NULL;
|
||||||
|
pIter->i = 0;
|
||||||
|
} else {
|
||||||
|
ASSERT(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SColVal *tRowIterNext(SRowIter *pIter) {
|
||||||
|
if (pIter->pRow->type == 0) {
|
||||||
|
if (pIter->i < pIter->pTSchema->numOfCols) {
|
||||||
|
tsdbRowGetColVal(pIter->pRow, pIter->pTSchema, pIter->i, &pIter->colVal);
|
||||||
|
pIter->i++;
|
||||||
|
|
||||||
|
return &pIter->colVal;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (pIter->i < taosArrayGetSize(pIter->pRow->pBlockData->apColData)) {
|
||||||
|
SColData *pColData = (SColData *)taosArrayGetP(pIter->pRow->pBlockData->apColData, pIter->i);
|
||||||
|
|
||||||
|
tColDataGetValue(pColData, pIter->pRow->iRow, &pIter->colVal);
|
||||||
|
pIter->i++;
|
||||||
|
|
||||||
|
return &pIter->colVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
// delete skyline ======================================================
|
// delete skyline ======================================================
|
||||||
static int32_t tsdbMergeSkyline(SArray *aSkyline1, SArray *aSkyline2, SArray *aSkyline) {
|
static int32_t tsdbMergeSkyline(SArray *aSkyline1, SArray *aSkyline2, SArray *aSkyline) {
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
|
@ -731,6 +768,10 @@ int32_t tColDataAppendValue(SColData *pColData, SColVal *pColVal) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tColDataGetValue(SColData *pColData, int32_t iRow, SColVal *pColVal) {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
|
||||||
int32_t tColDataCmprFn(const void *p1, const void *p2) {
|
int32_t tColDataCmprFn(const void *p1, const void *p2) {
|
||||||
if (((SColData *)p1)->cid < ((SColData *)p2)->cid) {
|
if (((SColData *)p1)->cid < ((SColData *)p2)->cid) {
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -834,14 +875,16 @@ int32_t tBlockDataAppendRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTS
|
||||||
pBlockData->aVersion[nRow] = key.version;
|
pBlockData->aVersion[nRow] = key.version;
|
||||||
pBlockData->aTSKEY[nRow] = key.ts;
|
pBlockData->aTSKEY[nRow] = key.ts;
|
||||||
|
|
||||||
// OTHER
|
// OTHER
|
||||||
#if 0
|
int32_t iColData = 0;
|
||||||
int32_t iColData = 0;
|
int32_t nColData = taosArrayGetSize(pBlockData->apColData);
|
||||||
int32_t nColData = taosArrayGetSize(pBlockData->apColData);
|
SRowIter ri;
|
||||||
SRowIter ri = tRowIterInit(pRow, pTSchema);
|
SColData *pColData;
|
||||||
|
SColVal *pColVal;
|
||||||
|
|
||||||
SColData *pColData = iColData < nColData ? (SColData *)taosArrayGetP(pBlockData->apColData, iColData) : NULL;
|
tRowIterInit(&ri, pRow, pTSchema);
|
||||||
SColVal *pColVal = tRowIterNext(&ri);
|
pColData = iColData < nColData ? (SColData *)taosArrayGetP(pBlockData->apColData, iColData) : NULL;
|
||||||
|
pColVal = tRowIterNext(&ri);
|
||||||
while (true) {
|
while (true) {
|
||||||
if (pColData && pColVal) {
|
if (pColData && pColVal) {
|
||||||
if (pColData->cid == pColVal->cid) {
|
if (pColData->cid == pColVal->cid) {
|
||||||
|
@ -861,7 +904,6 @@ int32_t tBlockDataAppendRow(SBlockData *pBlockData, TSDBROW *pRow, STSchema *pTS
|
||||||
// add a new SColData and append value
|
// add a new SColData and append value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
return code;
|
return code;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue