未验证 提交 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
......@@ -4023,7 +4023,7 @@ static int32_t getColQueryCondExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, tSqlEx
UNUSED(code);
// TODO: more error handling
} END_TRY
// add to required table column list
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, i);
int64_t uid = pTableMetaInfo->pTableMeta->id.uid;
......@@ -5208,7 +5208,7 @@ static int32_t getTagQueryCondExpr(SSqlCmd* pCmd, SQueryInfo* pQueryInfo, SCondE
UNUSED(code);
// TODO: more error handling
} END_TRY
// add to required table column list
STableMetaInfo* pTableMetaInfo = tscGetMetaInfo(pQueryInfo, i);
int64_t uid = pTableMetaInfo->pTableMeta->id.uid;
......
......@@ -180,6 +180,8 @@ typedef struct SFilterGroup {
typedef struct SFilterColInfo {
uint8_t type;
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;
} SFilterColInfo;
......
......@@ -1997,6 +1997,10 @@ int32_t filterMergeUnits(SFilterInfo *info, SFilterGroupCtx* gRes, uint16_t colI
filterAddUnitRange(info, u, ctx, TSDB_RELATION_AND);
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);
......@@ -2112,6 +2116,15 @@ void filterCheckColConflict(SFilterGroupCtx* gRes1, SFilterGroupCtx* gRes2, bool
*conflict = true;
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;
equal = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册