fix: disable table count scan optimized when filters and group by both exist

This commit is contained in:
slzhou 2023-05-12 18:51:18 +08:00
parent 35fcb34888
commit 5b866edae7
2 changed files with 12 additions and 3 deletions

View File

@ -2596,11 +2596,13 @@ static bool tbCntScanOptIsEligibleConds(STbCntScanOptInfo* pInfo, SNode* pCondit
} }
if (QUERY_NODE_LOGIC_CONDITION == nodeType(pConditions)) { if (QUERY_NODE_LOGIC_CONDITION == nodeType(pConditions)) {
return tbCntScanOptIsEligibleLogicCond(pInfo, (SLogicConditionNode*)pConditions); return tbCntScanOptIsEligibleLogicCond(pInfo, (SLogicConditionNode*)pConditions) &&
LIST_LENGTH(pInfo->pAgg->pGroupKeys) == 0;
} }
if (QUERY_NODE_OPERATOR == nodeType(pConditions)) { if (QUERY_NODE_OPERATOR == nodeType(pConditions)) {
return tbCntScanOptIsEligibleOpCond((SOperatorNode*)pConditions); return tbCntScanOptIsEligibleOpCond((SOperatorNode*)pConditions) &&
LIST_LENGTH(pInfo->pAgg->pGroupKeys) == 0;
} }
return false; return false;

View File

@ -103,7 +103,14 @@ endi
if $data62 != 5 then if $data62 != 5 then
return -1 return -1
endi endi
sql select count(table_name) from information_schema.ins_tables where db_name='db1' and stable_name='sta' group by stable_name
print $rows , $data00
if $rows != 1 then
return -1
endi
if $data00 != 8 then
return -1
endi
sql select distinct db_name from information_schema.ins_tables; sql select distinct db_name from information_schema.ins_tables;
print $rows print $rows
if $rows != 4 then if $rows != 4 then