Skip to content

Commit ebcd4dd

Browse files
committed
Better (methinks) inversion choice when the OR condition includes a node which is also matched directly
1 parent b801499 commit ebcd4dd

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/jrd/optimizer/Retrieval.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,19 +1393,35 @@ InversionCandidate* Retrieval::makeInversion(InversionCandidateList& inversions)
13931393

13941394
// Look if a match is already used by previous matches.
13951395
bool anyMatchAlreadyUsed = false, matchUsedByNavigation = false;
1396-
for (const auto currentMatch : currentInv->matches)
1396+
if (currentInv->boolean)
13971397
{
1398-
if (matches.exist(currentMatch))
1398+
if (matches.exist(currentInv->boolean))
13991399
{
14001400
anyMatchAlreadyUsed = true;
14011401

14021402
if (navigationCandidate &&
1403-
navigationCandidate->matches.exist(currentMatch))
1403+
navigationCandidate->matches.exist(currentInv->boolean))
14041404
{
14051405
matchUsedByNavigation = true;
14061406
}
1407+
}
1408+
}
1409+
else
1410+
{
1411+
for (const auto currentMatch : currentInv->matches)
1412+
{
1413+
if (matches.exist(currentMatch))
1414+
{
1415+
anyMatchAlreadyUsed = true;
14071416

1408-
break;
1417+
if (navigationCandidate &&
1418+
navigationCandidate->matches.exist(currentMatch))
1419+
{
1420+
matchUsedByNavigation = true;
1421+
}
1422+
1423+
break;
1424+
}
14091425
}
14101426
}
14111427

0 commit comments

Comments
 (0)