refactor: do tsdbread refactor.
This commit is contained in:
parent
ce15ee0e41
commit
dbd8c300fa
|
@ -101,17 +101,17 @@ typedef struct SColumnInfoData {
|
|||
} SColumnInfoData;
|
||||
|
||||
typedef struct SQueryTableDataCond {
|
||||
// STimeWindow twindow;
|
||||
uint64_t suid;
|
||||
int32_t order; // desc|asc order to iterate the data block
|
||||
int32_t numOfCols;
|
||||
SColumnInfo* colList;
|
||||
bool loadExternalRows; // load external rows or not
|
||||
int32_t type; // data block load type:
|
||||
int32_t type; // data block load type:
|
||||
int32_t numOfTWindows;
|
||||
STimeWindow* twindows;
|
||||
int64_t startVersion;
|
||||
int64_t endVersion;
|
||||
int32_t numOfTables; // number of tables
|
||||
uint64_t* uidList; // table uid list
|
||||
int64_t startVersion; // start version
|
||||
int64_t endVersion; // end version
|
||||
} SQueryTableDataCond;
|
||||
|
||||
void* blockDataDestroy(SSDataBlock* pBlock);
|
||||
|
|
|
@ -116,12 +116,11 @@ int32_t metaTbCursorNext(SMTbCursor *pTbCur);
|
|||
// typedef struct STsdb STsdb;
|
||||
typedef struct STsdbReader STsdbReader;
|
||||
|
||||
#define BLOCK_LOAD_OFFSET_SEQ_ORDER 1
|
||||
#define BLOCK_LOAD_TABLE_SEQ_ORDER 2
|
||||
#define BLOCK_LOAD_TABLE_RR_ORDER 3
|
||||
#define BLOCK_LOAD_OFFSET_ORDER 1
|
||||
#define BLOCK_LOAD_TABLESEQ_ORDER 2
|
||||
#define BLOCK_LOAD_EXTERN_ORDER 3
|
||||
|
||||
int32_t tsdbReaderOpen(SVnode *pVnode, SQueryTableDataCond *pCond, STableListInfo *tableInfoGroup, uint64_t qId,
|
||||
uint64_t taskId, STsdbReader **ppReader);
|
||||
int32_t tsdbReaderOpen(SVnode* pVnode, SQueryTableDataCond* pCond, STableListInfo* pTableList, uint64_t qId, uint64_t taskId, STsdbReader** ppReader);
|
||||
void tsdbReaderClose(STsdbReader *pReader);
|
||||
bool tsdbNextDataBlock(STsdbReader *pReader);
|
||||
void tsdbRetrieveDataBlockInfo(STsdbReader *pReader, SDataBlockInfo *pDataBlockInfo);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -620,8 +620,6 @@ SColumn extractColumnFromColumnNode(SColumnNode* pColNode) {
|
|||
}
|
||||
|
||||
int32_t initQueryTableDataCond(SQueryTableDataCond* pCond, const STableScanPhysiNode* pTableScanNode) {
|
||||
pCond->loadExternalRows = false;
|
||||
|
||||
pCond->order = pTableScanNode->scanSeq[0] > 0 ? TSDB_ORDER_ASC : TSDB_ORDER_DESC;
|
||||
pCond->numOfCols = LIST_LENGTH(pTableScanNode->scan.pScanCols);
|
||||
pCond->colList = taosMemoryCalloc(pCond->numOfCols, sizeof(SColumnInfo));
|
||||
|
@ -647,15 +645,7 @@ int32_t initQueryTableDataCond(SQueryTableDataCond* pCond, const STableScanPhysi
|
|||
}
|
||||
#endif
|
||||
|
||||
for (int32_t i = 0; i < pCond->numOfTWindows; ++i) {
|
||||
if ((pCond->order == TSDB_ORDER_ASC && pCond->twindows[i].skey > pCond->twindows[i].ekey) ||
|
||||
(pCond->order == TSDB_ORDER_DESC && pCond->twindows[i].skey < pCond->twindows[i].ekey)) {
|
||||
TSWAP(pCond->twindows[i].skey, pCond->twindows[i].ekey);
|
||||
}
|
||||
}
|
||||
taosqsort(pCond->twindows, pCond->numOfTWindows, sizeof(STimeWindow), pCond, compareTimeWindow);
|
||||
|
||||
pCond->type = BLOCK_LOAD_OFFSET_SEQ_ORDER;
|
||||
pCond->type = BLOCK_LOAD_OFFSET_ORDER;
|
||||
// pCond->type = pTableScanNode->scanFlag;
|
||||
|
||||
int32_t j = 0;
|
||||
|
@ -677,6 +667,5 @@ int32_t initQueryTableDataCond(SQueryTableDataCond* pCond, const STableScanPhysi
|
|||
}
|
||||
|
||||
void cleanupQueryTableDataCond(SQueryTableDataCond* pCond) {
|
||||
taosMemoryFree(pCond->twindows);
|
||||
taosMemoryFree(pCond->colList);
|
||||
}
|
|
@ -4306,7 +4306,11 @@ STsdbReader* doCreateDataReader(STableScanPhysiNode* pTableScanNode, SReadHandle
|
|||
}
|
||||
|
||||
STsdbReader* pReader;
|
||||
tsdbReaderOpen(pHandle->vnode, &cond, pTableListInfo, queryId, taskId, &pReader);
|
||||
code = tsdbReaderOpen(pHandle->vnode, &cond, pTableListInfo, queryId, taskId, &pReader);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
goto _error;
|
||||
}
|
||||
|
||||
cleanupQueryTableDataCond(&cond);
|
||||
|
||||
return pReader;
|
||||
|
|
Loading…
Reference in New Issue