opt: optimize generating groupid in partition/group by tag
This commit is contained in:
parent
cb85ee6d3c
commit
7435221e32
|
@ -695,6 +695,8 @@ int32_t* taosGetErrno();
|
||||||
#define TSDB_CODE_RSMA_INVALID_ENV TAOS_DEF_ERROR_CODE(0, 0x3150)
|
#define TSDB_CODE_RSMA_INVALID_ENV TAOS_DEF_ERROR_CODE(0, 0x3150)
|
||||||
#define TSDB_CODE_RSMA_INVALID_STAT TAOS_DEF_ERROR_CODE(0, 0x3151)
|
#define TSDB_CODE_RSMA_INVALID_STAT TAOS_DEF_ERROR_CODE(0, 0x3151)
|
||||||
|
|
||||||
|
//index
|
||||||
|
#define TSDB_CODE_INDEX_REBUILDING TAOS_DEF_ERROR_CODE(0, 0x3200)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -4690,8 +4690,9 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SArray* groupKyes = extractPartitionColInfo(pTableScanNode->pPartitionKeys);
|
SArray* groupKeys = extractPartitionColInfo(pTableScanNode->pPartitionKeys);
|
||||||
code = generateGroupIdMap(pTableListInfo, pHandle, groupKyes); //todo for json
|
code = generateGroupIdMap(pTableListInfo, pHandle, groupKeys); //todo for json
|
||||||
|
taosArrayDestroy(groupKeys);
|
||||||
if (code){
|
if (code){
|
||||||
tsdbCleanupReadHandle(pDataReader);
|
tsdbCleanupReadHandle(pDataReader);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -4725,8 +4726,9 @@ SOperatorInfo* createOperatorTree(SPhysiNode* pPhyNode, SExecTaskInfo* pTaskInfo
|
||||||
qDebug("%s pDataReader is not NULL", GET_TASKID(pTaskInfo));
|
qDebug("%s pDataReader is not NULL", GET_TASKID(pTaskInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
SArray* groupKyes = extractPartitionColInfo(pTableScanNode->pPartitionKeys);
|
SArray* groupKeys = extractPartitionColInfo(pTableScanNode->pPartitionKeys);
|
||||||
int32_t code = generateGroupIdMap(pTableListInfo, pHandle, groupKyes); //todo for json
|
int32_t code = generateGroupIdMap(pTableListInfo, pHandle, groupKeys); //todo for json
|
||||||
|
taosArrayDestroy(groupKeys);
|
||||||
if (code){
|
if (code){
|
||||||
tsdbCleanupReadHandle(pDataReader);
|
tsdbCleanupReadHandle(pDataReader);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -5059,6 +5061,7 @@ SArray* extractColumnInfo(SNodeList* pNodeList) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SArray* extractPartitionColInfo(SNodeList* pNodeList) {
|
SArray* extractPartitionColInfo(SNodeList* pNodeList) {
|
||||||
|
if(!pNodeList) return NULL;
|
||||||
size_t numOfCols = LIST_LENGTH(pNodeList);
|
size_t numOfCols = LIST_LENGTH(pNodeList);
|
||||||
SArray* pList = taosArrayInit(numOfCols, sizeof(SColumn));
|
SArray* pList = taosArrayInit(numOfCols, sizeof(SColumn));
|
||||||
if (pList == NULL) {
|
if (pList == NULL) {
|
||||||
|
@ -5163,7 +5166,9 @@ int32_t getTableList(void* metaHandle, int32_t tableType, uint64_t tableUid, STa
|
||||||
|
|
||||||
SArray* res = taosArrayInit(8, sizeof(uint64_t));
|
SArray* res = taosArrayInit(8, sizeof(uint64_t));
|
||||||
code = doFilterTag(pTagCond, &metaArg, res);
|
code = doFilterTag(pTagCond, &metaArg, res);
|
||||||
if (code != TSDB_CODE_SUCCESS) {
|
if (code == TSDB_CODE_INDEX_REBUILDING){ // todo
|
||||||
|
// doFilter();
|
||||||
|
} else if (code != TSDB_CODE_SUCCESS) {
|
||||||
qError("failed to get tableIds, reason: %s, suid: %" PRIu64 "", tstrerror(code), tableUid);
|
qError("failed to get tableIds, reason: %s, suid: %" PRIu64 "", tstrerror(code), tableUid);
|
||||||
taosArrayDestroy(res);
|
taosArrayDestroy(res);
|
||||||
terrno = code;
|
terrno = code;
|
||||||
|
@ -5171,6 +5176,7 @@ int32_t getTableList(void* metaHandle, int32_t tableType, uint64_t tableUid, STa
|
||||||
} else {
|
} else {
|
||||||
qDebug("sucess to get tableIds, size: %d, suid: %" PRIu64 "", (int)taosArrayGetSize(res), tableUid);
|
qDebug("sucess to get tableIds, size: %d, suid: %" PRIu64 "", (int)taosArrayGetSize(res), tableUid);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < taosArrayGetSize(res); i++) {
|
for (int i = 0; i < taosArrayGetSize(res); i++) {
|
||||||
STableKeyInfo info = {.lastKey = TSKEY_INITIAL_VAL, .uid = *(uint64_t*)taosArrayGet(res, i)};
|
STableKeyInfo info = {.lastKey = TSKEY_INITIAL_VAL, .uid = *(uint64_t*)taosArrayGet(res, i)};
|
||||||
taosArrayPush(pListInfo->pTableList, &info);
|
taosArrayPush(pListInfo->pTableList, &info);
|
||||||
|
|
|
@ -566,6 +566,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TSMA_RM_SKEY_IN_HASH, "Rm tsma skey in cac
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_INVALID_ENV, "Invalid rsma env")
|
TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_INVALID_ENV, "Invalid rsma env")
|
||||||
TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_INVALID_STAT, "Invalid rsma state")
|
TAOS_DEFINE_ERROR(TSDB_CODE_RSMA_INVALID_STAT, "Invalid rsma state")
|
||||||
|
|
||||||
|
TAOS_DEFINE_ERROR(TSDB_CODE_INDEX_REBUILDING, "Index is rebuilding")
|
||||||
|
|
||||||
#ifdef TAOS_ERROR_C
|
#ifdef TAOS_ERROR_C
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue