未验证 提交 2d5d645b 编写于 作者: wmmhello's avatar wmmhello 提交者: GitHub

Merge pull request #8432 from taosdata/fix/TD-5939

Fix/td 5939 fix long time cost in long RELATION_IN operation
...@@ -180,6 +180,8 @@ typedef struct SFilterGroup { ...@@ -180,6 +180,8 @@ typedef struct SFilterGroup {
typedef struct SFilterColInfo { typedef struct SFilterColInfo {
uint8_t type; uint8_t type;
int32_t dataType; int32_t dataType;
uint8_t optr; // for equal operation in the relation of RELATION_IN
int64_t value; // for equal operation in the relation of RELATION_IN
void *info; void *info;
} SFilterColInfo; } SFilterColInfo;
......
...@@ -1997,6 +1997,10 @@ int32_t filterMergeUnits(SFilterInfo *info, SFilterGroupCtx* gRes, uint16_t colI ...@@ -1997,6 +1997,10 @@ int32_t filterMergeUnits(SFilterInfo *info, SFilterGroupCtx* gRes, uint16_t colI
filterAddUnitRange(info, u, ctx, TSDB_RELATION_AND); filterAddUnitRange(info, u, ctx, TSDB_RELATION_AND);
CHK_JMP(MR_EMPTY_RES(ctx)); CHK_JMP(MR_EMPTY_RES(ctx));
} }
if(FILTER_UNIT_OPTR(u) == TSDB_RELATION_EQUAL && !FILTER_NO_MERGE_DATA_TYPE(FILTER_UNIT_DATA_TYPE(u))){
gRes->colInfo[colIdx].optr = TSDB_RELATION_EQUAL;
SIMPLE_COPY_VALUES(&gRes->colInfo[colIdx].value, FILTER_UNIT_VAL_DATA(info, u));
}
} }
taosArrayDestroy(colArray); taosArrayDestroy(colArray);
...@@ -2113,6 +2117,15 @@ void filterCheckColConflict(SFilterGroupCtx* gRes1, SFilterGroupCtx* gRes2, bool ...@@ -2113,6 +2117,15 @@ void filterCheckColConflict(SFilterGroupCtx* gRes1, SFilterGroupCtx* gRes2, bool
return; return;
} }
// for long in operation
if (gRes1->colInfo[idx1].optr == TSDB_RELATION_EQUAL && gRes2->colInfo[idx2].optr == TSDB_RELATION_EQUAL) {
SFilterRangeCtx* ctx = gRes1->colInfo[idx1].info;
if (ctx->pCompareFunc(&gRes1->colInfo[idx1].value, &gRes2->colInfo[idx2].value)){
*conflict = true;
return;
}
}
++n; ++n;
equal = true; equal = true;
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册