Merge pull request #20183 from taosdata/fix/TD-22797
fix: avoid filter slow when not exist target value
This commit is contained in:
commit
52a8912969
|
@ -1301,6 +1301,7 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
|
||||||
|
|
||||||
/// src: [[suid, cid1, type1]....[suid, cid2, type2]....[suid, cid3, type3]...]
|
/// src: [[suid, cid1, type1]....[suid, cid2, type2]....[suid, cid3, type3]...]
|
||||||
/// target: [suid, cid2, type2]
|
/// target: [suid, cid2, type2]
|
||||||
|
int diffCidCount = 0;
|
||||||
do {
|
do {
|
||||||
void *entryKey = NULL, *entryVal = NULL;
|
void *entryKey = NULL, *entryVal = NULL;
|
||||||
int32_t nEntryKey, nEntryVal;
|
int32_t nEntryKey, nEntryVal;
|
||||||
|
@ -1317,7 +1318,9 @@ int32_t metaFilterTableIds(SMeta *pMeta, SMetaFltParam *param, SArray *pUids) {
|
||||||
if (p == NULL) break;
|
if (p == NULL) break;
|
||||||
|
|
||||||
if (p->type != pCursor->type || p->suid != pCursor->suid || p->cid != pCursor->cid) {
|
if (p->type != pCursor->type || p->suid != pCursor->suid || p->cid != pCursor->cid) {
|
||||||
if (found == true) break;
|
if (found == true) break; //
|
||||||
|
if (diffCidCount > TRY_ERROR_LIMIT) break;
|
||||||
|
diffCidCount++;
|
||||||
count++;
|
count++;
|
||||||
valid = param->reverse ? tdbTbcMoveToPrev(pCursor->pCur) : tdbTbcMoveToNext(pCursor->pCur);
|
valid = param->reverse ? tdbTbcMoveToPrev(pCursor->pCur) : tdbTbcMoveToNext(pCursor->pCur);
|
||||||
if (valid < 0) {
|
if (valid < 0) {
|
||||||
|
|
|
@ -7,7 +7,7 @@ print ======== step0
|
||||||
$dbPrefix = ta_3_db
|
$dbPrefix = ta_3_db
|
||||||
$tbPrefix = ta_3_tb
|
$tbPrefix = ta_3_tb
|
||||||
$mtPrefix = ta_3_mt
|
$mtPrefix = ta_3_mt
|
||||||
$tbNum = 100
|
$tbNum = 500
|
||||||
$rowNum = 20
|
$rowNum = 20
|
||||||
$totalNum = 200
|
$totalNum = 200
|
||||||
|
|
||||||
|
@ -26,9 +26,10 @@ endi
|
||||||
print =============== create child table
|
print =============== create child table
|
||||||
|
|
||||||
$i = 0
|
$i = 0
|
||||||
|
$val = 1
|
||||||
while $i < $tbNum
|
while $i < $tbNum
|
||||||
$tb = $tbPrefix . $i
|
$tb = $tbPrefix . $i
|
||||||
sql create table $tb using $mtPrefix tags( $i , $i , $i , $i , $i );
|
sql create table $tb using $mtPrefix tags( $i , $i , $i , $i , $val );
|
||||||
$i = $i + 1
|
$i = $i + 1
|
||||||
endw
|
endw
|
||||||
|
|
||||||
|
@ -49,6 +50,7 @@ endw
|
||||||
|
|
||||||
|
|
||||||
sql create index ti2 on $mtPrefix (t2)
|
sql create index ti2 on $mtPrefix (t2)
|
||||||
|
sql create index ti5 on $mtPrefix (t5)
|
||||||
|
|
||||||
print ==== test name conflict
|
print ==== test name conflict
|
||||||
#
|
#
|
||||||
|
@ -120,6 +122,53 @@ while $i < $tbNum
|
||||||
$i = $i + 1
|
$i = $i + 1
|
||||||
endw
|
endw
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# test special boundary condtion
|
||||||
|
print ===== test operator low on ti5
|
||||||
|
# great equal than
|
||||||
|
sql select * from $mtPrefix where t5 < 0 ;
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print ===== test operator lower equal on ti5
|
||||||
|
# great equal than
|
||||||
|
sql select * from $mtPrefix where t5 <= $val ;
|
||||||
|
if $rows != $tbNum then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print ===== test operator equal on ti5
|
||||||
|
# great equal than
|
||||||
|
sql select * from $mtPrefix where t5 = $val ;
|
||||||
|
if $rows != $tbNum then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print ===== test operator great equal on ti5
|
||||||
|
# great equal than
|
||||||
|
sql select * from $mtPrefix where t5 >= $val ;
|
||||||
|
if $rows != $tbNum then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print ===== test operator great than on ti5
|
||||||
|
# great equal than
|
||||||
|
sql select * from $mtPrefix where t5 > $val ;
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
print ===== test operator great on ti5
|
||||||
|
# great equal than
|
||||||
|
sql select * from $mtPrefix where t5 > $val + 1 ;
|
||||||
|
if $rows != 0 then
|
||||||
|
return -1
|
||||||
|
endi
|
||||||
|
|
||||||
|
sql drop index ti5
|
||||||
|
|
||||||
print ===== add table after index created
|
print ===== add table after index created
|
||||||
$interval = $tbNum + $tbNum
|
$interval = $tbNum + $tbNum
|
||||||
$i = $interval
|
$i = $interval
|
||||||
|
@ -130,8 +179,6 @@ while $i < $limit
|
||||||
$i = $i + 1
|
$i = $i + 1
|
||||||
endw
|
endw
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print ===== add table after index created (opeator great equal than)
|
print ===== add table after index created (opeator great equal than)
|
||||||
# great equal than
|
# great equal than
|
||||||
$i = $interval
|
$i = $interval
|
||||||
|
|
Loading…
Reference in New Issue