fix duplicate uid
This commit is contained in:
parent
ffedfbaf1e
commit
af1a40a7ff
|
@ -17,6 +17,7 @@
|
||||||
#include "index.h"
|
#include "index.h"
|
||||||
#include "indexComm.h"
|
#include "indexComm.h"
|
||||||
#include "indexInt.h"
|
#include "indexInt.h"
|
||||||
|
#include "indexUtil.h"
|
||||||
#include "nodes.h"
|
#include "nodes.h"
|
||||||
#include "querynodes.h"
|
#include "querynodes.h"
|
||||||
#include "scalar.h"
|
#include "scalar.h"
|
||||||
|
@ -77,15 +78,15 @@ typedef struct SIFParam {
|
||||||
char dbName[TSDB_DB_NAME_LEN];
|
char dbName[TSDB_DB_NAME_LEN];
|
||||||
char colName[TSDB_COL_NAME_LEN * 2 + 4];
|
char colName[TSDB_COL_NAME_LEN * 2 + 4];
|
||||||
|
|
||||||
SIndexMetaArg arg;
|
SIndexMetaArg arg;
|
||||||
SMetaDataFilterAPI api;
|
SMetaDataFilterAPI api;
|
||||||
} SIFParam;
|
} SIFParam;
|
||||||
|
|
||||||
typedef struct SIFCtx {
|
typedef struct SIFCtx {
|
||||||
int32_t code;
|
int32_t code;
|
||||||
SHashObj *pRes; /* element is SIFParam */
|
SHashObj *pRes; /* element is SIFParam */
|
||||||
bool noExec; // true: just iterate condition tree, and add hint to executor plan
|
bool noExec; // true: just iterate condition tree, and add hint to executor plan
|
||||||
SIndexMetaArg arg;
|
SIndexMetaArg arg;
|
||||||
SMetaDataFilterAPI *pAPI;
|
SMetaDataFilterAPI *pAPI;
|
||||||
} SIFCtx;
|
} SIFCtx;
|
||||||
|
|
||||||
|
@ -669,6 +670,10 @@ static int32_t sifDoIndex(SIFParam *left, SIFParam *right, int8_t operType, SIFP
|
||||||
if (sifSetFltParam(left, right, &typedata, ¶m) != 0) return -1;
|
if (sifSetFltParam(left, right, &typedata, ¶m) != 0) return -1;
|
||||||
}
|
}
|
||||||
ret = left->api.metaFilterTableIds(arg->metaEx, ¶m, output->result);
|
ret = left->api.metaFilterTableIds(arg->metaEx, ¶m, output->result);
|
||||||
|
if (ret == 0) {
|
||||||
|
taosArraySort(output->result, uidCompare);
|
||||||
|
taosArrayRemoveDuplicate(output->result, uidCompare, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -875,8 +880,8 @@ static int32_t sifExecLogic(SLogicConditionNode *node, SIFCtx *ctx, SIFParam *ou
|
||||||
} else if (node->condType == LOGIC_COND_TYPE_NOT) {
|
} else if (node->condType == LOGIC_COND_TYPE_NOT) {
|
||||||
// taosArrayAddAll(output->result, params[m].result);
|
// taosArrayAddAll(output->result, params[m].result);
|
||||||
}
|
}
|
||||||
taosArraySort(output->result, idxUidCompare);
|
taosArraySort(output->result, uidCompare);
|
||||||
taosArrayRemoveDuplicate(output->result, idxUidCompare, NULL);
|
taosArrayRemoveDuplicate(output->result, uidCompare, NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int32_t m = 0; m < node->pParameterList->length; m++) {
|
for (int32_t m = 0; m < node->pParameterList->length; m++) {
|
||||||
|
@ -1016,7 +1021,7 @@ static int32_t sifCalculate(SNode *pNode, SIFParam *pDst) {
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t sifGetFltHint(SNode *pNode, SIdxFltStatus *status, SMetaDataFilterAPI* pAPI) {
|
static int32_t sifGetFltHint(SNode *pNode, SIdxFltStatus *status, SMetaDataFilterAPI *pAPI) {
|
||||||
int32_t code = TSDB_CODE_SUCCESS;
|
int32_t code = TSDB_CODE_SUCCESS;
|
||||||
if (pNode == NULL) {
|
if (pNode == NULL) {
|
||||||
return TSDB_CODE_QRY_INVALID_INPUT;
|
return TSDB_CODE_QRY_INVALID_INPUT;
|
||||||
|
@ -1054,7 +1059,8 @@ static int32_t sifGetFltHint(SNode *pNode, SIdxFltStatus *status, SMetaDataFilte
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t doFilterTag(SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *result, SIdxFltStatus *status, SMetaDataFilterAPI* pAPI) {
|
int32_t doFilterTag(SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *result, SIdxFltStatus *status,
|
||||||
|
SMetaDataFilterAPI *pAPI) {
|
||||||
SIdxFltStatus st = idxGetFltStatus(pFilterNode, pAPI);
|
SIdxFltStatus st = idxGetFltStatus(pFilterNode, pAPI);
|
||||||
if (st == SFLT_NOT_INDEX) {
|
if (st == SFLT_NOT_INDEX) {
|
||||||
*status = st;
|
*status = st;
|
||||||
|
@ -1081,7 +1087,7 @@ int32_t doFilterTag(SNode *pFilterNode, SIndexMetaArg *metaArg, SArray *result,
|
||||||
return TSDB_CODE_SUCCESS;
|
return TSDB_CODE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
SIdxFltStatus idxGetFltStatus(SNode *pFilterNode, SMetaDataFilterAPI* pAPI) {
|
SIdxFltStatus idxGetFltStatus(SNode *pFilterNode, SMetaDataFilterAPI *pAPI) {
|
||||||
SIdxFltStatus st = SFLT_NOT_INDEX;
|
SIdxFltStatus st = SFLT_NOT_INDEX;
|
||||||
if (pFilterNode == NULL) {
|
if (pFilterNode == NULL) {
|
||||||
return SFLT_NOT_INDEX;
|
return SFLT_NOT_INDEX;
|
||||||
|
|
Loading…
Reference in New Issue