[MCOL-1029] Logic issue breaking multiple where conditions Created: 2017-11-13 Updated: 2020-05-04 Resolved: 2017-12-05 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | None |
| Affects Version/s: | 1.0.11, 1.1.1 |
| Fix Version/s: | 1.0.12, 1.1.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Andrew Hutchings (Inactive) | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Epic Link: | ColumnStore Compatibility Improvements |
| Sprint: | 2017-23, 2017-24 |
| Description |
|
An always-true WHERE condition added to a query with at least 2 normal WHERE conditions generates more results. Essentially removing the first WHERE condition. Example with partsupp table:
This happens with:
|
| Comments |
| Comment by Andrew Hutchings (Inactive) [ 2017-11-13 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Execution plan seems to indicate that the (TRUE OR FALSE) turns the two simple filters into an OR instead of an AND. First (good) query:
Second (bad) query:
Notice the final operator ("or" instead of "and"). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Andrew Hutchings (Inactive) [ 2017-11-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
OK, cause is a little complex, so stick with me... The (TRUE OR FALSE) resolves internally to a CACHE_ITEM containing a COND_ITEM with two arguments. Now, usually with the parse the arguments are parsed first and then we get the COND_ITEM afterwords. We use a stack for this and just pop off the stack during COND_ITEM. For the CACHE_ITEM we haven't put any items on the stack and we are still in the middle of trying to put things on the stack for the AND conditions. This means that the two previous conditions are on the stack, the COND_ITEM inside CACHE_ITEM is used and that adds an OR between the other two conditions. Current working theory being tested is there is no scenario where a CACHE_ITEM containing a COND_ITEM will need to be executed. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Andrew Hutchings (Inactive) [ 2017-11-20 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Pull request for 1.0 and 1.1. Do not merge 1.1 until after 1.1.2 has been released. For QA: See description, both the queries should return the same results. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Daniel Lee (Inactive) [ 2017-12-05 ] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Builds verified: GitHub source 1.0.12-1 [root@localhost ~]# cat mariadb-columnstore-1.0.12-1-centos7.x86_64.bin.tar.txt Merge pull request #79 from mariadb-corporation/ /root/columnstore/mariadb-columnstore-server/mariadb-columnstore-engine Merge pull request #338 from mariadb-corporation/ 1.1.3-1 /root/columnstore/mariadb-columnstore-server Merge branch 'develop-1.1' of https://github.com/mariadb-corporation/mariadb-columnstore-server into develop-1.1 /root/columnstore/mariadb-columnstore-server/mariadb-columnstore-engine change how the os_detect is run on remote nodes Verified mentioned queries. Also tried queries with differ expressions that always evaluate to be true, such as 1>0. |