Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MB-42474 Set exact spans properly in case of multiple spans for the s…
…ame index The problematic query has a predicate with OR clause and uses the same index with multiple spans. On one side of the OR we use 2 sargable keys and on the other side of the OR we use 1 sargable key. Both sides have exact span set to true, however there is a different predicate on the OR arm which is not considered (since on that side only a single sargable key is available), but we did not detect it since when we determine on index pushdown later on we take the max of the sargable keys from all arms of the OR clause. To fix this, we add logic in sargForOR, when we iterate through different arms of the OR clause, borrow logic from index pushdown determination to properly detect whether there is a predicate that is not sargable, in which case set exact span to be false. Change-Id: I147a0d94e9bcc21d8d2d5643db882a866f24b304 Reviewed-on: http://review.couchbase.org/c/query/+/139700 Reviewed-by: Sitaram Vemulapalli <sitaram.vemulapalli@couchbase.com> Tested-by: Bingjie Miao <bingjie.miao@couchbase.com> Reviewed-on: http://review.couchbase.org/c/query/+/139745 Well-Formed: Build Bot <build@couchbase.com>
- Loading branch information
1 parent
9331b16
commit a5aa02a
Showing
8 changed files
with
86 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[ | ||
{ | ||
"testcase": "MB-42774", | ||
"ignore": "index_id", | ||
"explain": { | ||
"disabled": false, | ||
"results": [ | ||
{ | ||
"present": true | ||
} | ||
], | ||
"statement": "SELECT true AS present FROM $explan AS p WHERE ANY v WITHIN p.plan.`~children` SATISFIES v.`#operator` LIKE 'IndexScan%' AND v.`index_group_aggs` IS MISSING END" | ||
}, | ||
"statements": "SELECT count(1) AS cnt FROM orders WHERE (test_id = 'indexga' AND type = 'bugs') AND c1 = 'doc' AND (EVERY v IN a1 SATISFIES v.name != 'b1' END OR a1 IS MISSING)", | ||
"results": [ | ||
{ | ||
"cnt": 2 | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters