opt compile
This commit is contained in:
parent
f520de0dab
commit
c15b1e3520
|
@ -212,6 +212,7 @@ typedef struct SIndexMetaArg {
|
|||
void* idx;
|
||||
void* ivtIdx;
|
||||
uint64_t suid;
|
||||
int (*metaFilterFunc)(void* metaEx, void* param, SArray* result);
|
||||
} SIndexMetaArg;
|
||||
|
||||
typedef enum { SFLT_NOT_INDEX, SFLT_COARSE_INDEX, SFLT_ACCURATE_INDEX } SIdxFltStatus;
|
||||
|
|
|
@ -55,6 +55,16 @@ extern bool filterRangeExecute(SFilterInfo *info, SColumnDataAgg **pColsAgg,
|
|||
int32_t filterPartitionCond(SNode **pCondition, SNode **pPrimaryKeyCond, SNode **pTagIndexCond, SNode **pTagCond,
|
||||
SNode **pOtherCond);
|
||||
|
||||
typedef struct SMetaFltParam {
|
||||
tb_uid_t suid;
|
||||
int16_t cid;
|
||||
int16_t type;
|
||||
void *val;
|
||||
bool reverse;
|
||||
bool equal;
|
||||
int (*filterFunc)(void *a, void *b, int16_t type);
|
||||
} SMetaFltParam;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "tfs.h"
|
||||
#include "wal.h"
|
||||
|
||||
#include "filter.h"
|
||||
#include "tcommon.h"
|
||||
#include "tfs.h"
|
||||
#include "tgrant.h"
|
||||
|
@ -138,22 +139,11 @@ typedef struct {
|
|||
} SMetaStbStats;
|
||||
int32_t metaGetStbStats(SMeta *pMeta, int64_t uid, SMetaStbStats *pInfo);
|
||||
|
||||
typedef struct SMetaFltParam {
|
||||
tb_uid_t suid;
|
||||
int16_t cid;
|
||||
int16_t type;
|
||||
void *val;
|
||||
bool reverse;
|
||||
bool equal;
|
||||
int (*filterFunc)(void *a, void *b, int16_t type);
|
||||
|
||||
} SMetaFltParam;
|
||||
|
||||
// TODO, refactor later
|
||||
int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *results);
|
||||
int32_t metaFilterCreateTime(SMeta *pMeta, SMetaFltParam *parm, SArray *pUids);
|
||||
int32_t metaFilterTableName(SMeta *pMeta, SMetaFltParam *param, SArray *pUids);
|
||||
int32_t metaFilterTtl(SMeta *pMeta, SMetaFltParam *param, SArray *pUids);
|
||||
int32_t metaFilterTableIds(void *pMeta, void *param, SArray *results);
|
||||
int32_t metaFilterCreateTime(void *pMeta, void *parm, SArray *pUids);
|
||||
int32_t metaFilterTableName(void *pMeta, void *param, SArray *pUids);
|
||||
int32_t metaFilterTtl(void *pMeta, void *param, SArray *pUids);
|
||||
|
||||
#if 1 // refact APIs below (TODO)
|
||||
typedef SVCreateTbReq STbCfg;
|
||||
|
@ -183,7 +173,8 @@ typedef struct STsdbReader STsdbReader;
|
|||
#define CACHESCAN_RETRIEVE_LAST 0x8
|
||||
|
||||
int32_t tsdbReaderOpen(SVnode *pVnode, SQueryTableDataCond *pCond, void *pTableList, int32_t numOfTables,
|
||||
SSDataBlock *pResBlock, STsdbReader **ppReader, const char *idstr, bool countOnly, SHashObj** pIgnoreTables);
|
||||
SSDataBlock *pResBlock, STsdbReader **ppReader, const char *idstr, bool countOnly,
|
||||
SHashObj **pIgnoreTables);
|
||||
int32_t tsdbSetTableList(STsdbReader *pReader, const void *pTableList, int32_t num);
|
||||
void tsdbReaderSetId(STsdbReader *pReader, const char *idstr);
|
||||
void tsdbReaderClose(STsdbReader *pReader);
|
||||
|
|
|
@ -1083,7 +1083,9 @@ typedef struct {
|
|||
int32_t vLen;
|
||||
} SIdxCursor;
|
||||
|
||||
int32_t metaFilterCreateTime(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
|
||||
int32_t metaFilterCreateTime(void *meta, void *arg, SArray *pUids) {
|
||||
SMeta *pMeta = meta;
|
||||
SMetaFltParam *param = arg;
|
||||
int32_t ret = 0;
|
||||
|
||||
SIdxCursor *pCursor = NULL;
|
||||
|
@ -1141,7 +1143,9 @@ END:
|
|||
return ret;
|
||||
}
|
||||
|
||||
int32_t metaFilterTableName(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
|
||||
int32_t metaFilterTableName(void *meta, void *arg, SArray *pUids) {
|
||||
SMeta *pMeta = meta;
|
||||
SMetaFltParam *param = arg;
|
||||
int32_t ret = 0;
|
||||
char *buf = NULL;
|
||||
|
||||
|
@ -1206,7 +1210,9 @@ END:
|
|||
|
||||
return ret;
|
||||
}
|
||||
int32_t metaFilterTtl(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
|
||||
int32_t metaFilterTtl(void *meta, void *arg, SArray *pUids) {
|
||||
SMeta *pMeta = meta;
|
||||
SMetaFltParam *param = arg;
|
||||
int32_t ret = 0;
|
||||
char *buf = NULL;
|
||||
|
||||
|
@ -1235,7 +1241,10 @@ END:
|
|||
// impl later
|
||||
return 0;
|
||||
}
|
||||
int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
|
||||
int32_t metaFilterTableIds(void *meta, void *arg, SArray *pUids) {
|
||||
SMeta *pMeta = meta;
|
||||
SMetaFltParam *param = arg;
|
||||
|
||||
SMetaEntry oStbEntry = {0};
|
||||
int32_t ret = -1;
|
||||
char *buf = NULL;
|
||||
|
|
|
@ -435,7 +435,6 @@ static void genTagFilterDigest(const SNode* pTagCond, T_MD5_CTX* pContext) {
|
|||
taosMemoryFree(payload);
|
||||
}
|
||||
|
||||
|
||||
static void genTbGroupDigest(const SNode* pGroup, uint8_t* filterDigest, T_MD5_CTX* pContext) {
|
||||
char* payload = NULL;
|
||||
int32_t len = 0;
|
||||
|
@ -453,8 +452,8 @@ static void genTbGroupDigest(const SNode* pGroup, uint8_t* filterDigest, T_MD5_C
|
|||
taosMemoryFree(payload);
|
||||
}
|
||||
|
||||
|
||||
int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableListInfo* pTableListInfo, uint8_t *digest) {
|
||||
int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableListInfo* pTableListInfo,
|
||||
uint8_t* digest) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
SArray* pBlockList = NULL;
|
||||
SSDataBlock* pResBlock = NULL;
|
||||
|
@ -499,7 +498,8 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
|
|||
if (tableList) {
|
||||
taosArrayDestroy(pTableListInfo->pTableList);
|
||||
pTableListInfo->pTableList = tableList;
|
||||
qDebug("retrieve tb group list from cache, numOfTables:%d", (int32_t)taosArrayGetSize(pTableListInfo->pTableList));
|
||||
qDebug("retrieve tb group list from cache, numOfTables:%d",
|
||||
(int32_t)taosArrayGetSize(pTableListInfo->pTableList));
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
@ -632,7 +632,8 @@ int32_t getColInfoResultForGroupby(void* metaHandle, SNodeList* group, STableLis
|
|||
|
||||
if (tsTagFilterCache) {
|
||||
tableList = taosArrayDup(pTableListInfo->pTableList, NULL);
|
||||
metaPutTbGroupToCache(metaHandle, pTableListInfo->idInfo.suid, context.digest, tListLen(context.digest), tableList, taosArrayGetSize(tableList) * sizeof(STableKeyInfo));
|
||||
metaPutTbGroupToCache(metaHandle, pTableListInfo->idInfo.suid, context.digest, tListLen(context.digest), tableList,
|
||||
taosArrayGetSize(tableList) * sizeof(STableKeyInfo));
|
||||
}
|
||||
|
||||
// int64_t st2 = taosGetTimestampUs();
|
||||
|
@ -839,7 +840,6 @@ static int32_t optimizeTbnameInCondImpl(void* metaHandle, SArray* pExistedUidLis
|
|||
return -1;
|
||||
}
|
||||
|
||||
|
||||
static SSDataBlock* createTagValBlockForFilter(SArray* pColList, int32_t numOfTables, SArray* pUidTagList,
|
||||
void* metaHandle) {
|
||||
SSDataBlock* pResBlock = createDataBlock();
|
||||
|
@ -1096,8 +1096,11 @@ int32_t getTableList(void* metaHandle, void* pVnode, SScanPhysiNode* pScanNode,
|
|||
// failed to find the result in the cache, let try to calculate the results
|
||||
if (pTagIndexCond) {
|
||||
void* pIndex = tsdbGetIvtIdx(metaHandle);
|
||||
SIndexMetaArg metaArg = {
|
||||
.metaEx = metaHandle, .idx = tsdbGetIdx(metaHandle), .ivtIdx = pIndex, .suid = pScanNode->uid};
|
||||
SIndexMetaArg metaArg = {.metaEx = metaHandle,
|
||||
.idx = tsdbGetIdx(metaHandle),
|
||||
.ivtIdx = pIndex,
|
||||
.suid = pScanNode->uid,
|
||||
.metaFilterFunc = metaFilterTableIds};
|
||||
|
||||
status = SFLT_NOT_INDEX;
|
||||
code = doFilterTag(pTagIndexCond, &metaArg, pUidList, &status);
|
||||
|
@ -1841,9 +1844,7 @@ uint64_t tableListGetSize(const STableListInfo* pTableList) {
|
|||
return taosArrayGetSize(pTableList->pTableList);
|
||||
}
|
||||
|
||||
uint64_t tableListGetSuid(const STableListInfo* pTableList) {
|
||||
return pTableList->idInfo.suid;
|
||||
}
|
||||
uint64_t tableListGetSuid(const STableListInfo* pTableList) { return pTableList->idInfo.suid; }
|
||||
|
||||
STableKeyInfo* tableListGetInfo(const STableListInfo* pTableList, int32_t index) {
|
||||
if (taosArrayGetSize(pTableList->pTableList) == 0) {
|
||||
|
@ -2033,8 +2034,8 @@ static int32_t sortTableGroup(STableListInfo* pTableListInfo) {
|
|||
return TDB_CODE_SUCCESS;
|
||||
}
|
||||
|
||||
int32_t buildGroupIdMapForAllTables(STableListInfo* pTableListInfo, SReadHandle* pHandle, SScanPhysiNode* pScanNode, SNodeList* group,
|
||||
bool groupSort, uint8_t *digest) {
|
||||
int32_t buildGroupIdMapForAllTables(STableListInfo* pTableListInfo, SReadHandle* pHandle, SScanPhysiNode* pScanNode,
|
||||
SNodeList* group, bool groupSort, uint8_t* digest) {
|
||||
int32_t code = TSDB_CODE_SUCCESS;
|
||||
|
||||
bool groupByTbname = groupbyTbname(group);
|
||||
|
@ -2086,7 +2087,8 @@ int32_t createScanTableListInfo(SScanPhysiNode* pScanNode, SNodeList* pGroupTags
|
|||
}
|
||||
|
||||
uint8_t digest[17] = {0};
|
||||
int32_t code = getTableList(pHandle->meta, pHandle->vnode, pScanNode, pTagCond, pTagIndexCond, pTableListInfo, digest, idStr);
|
||||
int32_t code =
|
||||
getTableList(pHandle->meta, pHandle->vnode, pScanNode, pTagCond, pTagIndexCond, pTableListInfo, digest, idStr);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
qError("failed to getTableList, code: %s", tstrerror(code));
|
||||
return code;
|
||||
|
|
|
@ -12,7 +12,6 @@ target_link_libraries(
|
|||
PUBLIC os
|
||||
PUBLIC util
|
||||
PUBLIC common
|
||||
PUBLIC vnode
|
||||
PUBLIC nodes
|
||||
PUBLIC scalar
|
||||
PUBLIC function
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "filter.h"
|
||||
#include "index.h"
|
||||
#include "indexComm.h"
|
||||
#include "indexInt.h"
|
||||
|
@ -20,7 +21,6 @@
|
|||
#include "querynodes.h"
|
||||
#include "scalar.h"
|
||||
#include "tdatablock.h"
|
||||
#include "vnode.h"
|
||||
|
||||
// clang-format off
|
||||
#define SIF_ERR_RET(c) do { int32_t _code = c; if (_code != TSDB_CODE_SUCCESS) { terrno = _code; return _code; } } while (0)
|
||||
|
@ -659,7 +659,7 @@ static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFP
|
|||
} else {
|
||||
if (sifSetFltParam(left, right, &typedata, ¶m) != 0) return -1;
|
||||
}
|
||||
ret = metaFilterTableIds(arg->metaEx, ¶m, output->result);
|
||||
ret = arg->metaFilterFunc(arg->metaEx, ¶m, output->result);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue