[MDEV-16839] Upper Levels not set for Item_equal objects Created: 2018-07-27 Updated: 2023-11-10 |
|
| Status: | Stalled |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 5.5, 10.0, 10.1, 10.2, 10.3 |
| Fix Version/s: | 10.4 |
| Type: | Bug | Priority: | Major |
| Reporter: | Varun Gupta (Inactive) | Assignee: | Igor Babaev |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Description |
|
Here is the test case , where we see for Item_equal objects we don't see field upper_levels set
|
| Comments |
| Comment by Varun Gupta (Inactive) [ 2018-07-27 ] | ||||||||||||||||||||
|
A patch proposed was
| ||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2018-07-27 ] | ||||||||||||||||||||
|
Review comments from igor 1. Multiple equality multiple equal(1, `test`.`t1`.`c`, `test`.`t1`.`a`) does not inherit anything from the upper level (we have there only multiple equal(13, `test`.`t1`.`b`)). Here is another probable problem with your fix: 2. With your test case I never hit the second chunk (change) of your patch. In general it's not good. | ||||||||||||||||||||
| Comment by Galina Shalygina (Inactive) [ 2018-08-02 ] | ||||||||||||||||||||
|
The problem occurs in build_equal_items_for_cond() method when "((t1.c=1) AND (t1.a=t1.c))" is processed. This equalities can be merged in one multiple equality "multiple equal(1, `test`.`t1`.`c`, `test`.`t1`.`a`)". The type of this condition obviously should be MULT_EQ_FUNC. Nevertheless after the transformation of the AND condition into the multiple equality this condition remains COND_ITEM type that consists of one element.
Only after the remove_eq_conds() call it becomes MULT_EQ_FUNC element but upper_levels link is not set. For the multiple equality that was got from (t1.a=2) it is set. Both multiple equalities of this OR-level should have the same upper_levels field.
The bug appears because build_equal_items_for_cond() doesn't process the case when AND-condition is transformed into the single multiple equality item in the right way. To fix it build_equal_items_for_cond() should be changed. | ||||||||||||||||||||
| Comment by Igor Babaev [ 2019-05-02 ] | ||||||||||||||||||||
|
Galina, |