[MCOL-424] cross engine subquery losing where clause causing incorrect results Created: 2016-11-29 Updated: 2021-06-11 Resolved: 2016-12-02 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | David Thompson (Inactive) | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Sprint: | 2016-23 | ||||||||||||||||
| Description |
|
Query: It is returning all rows from member_test In info.log on um1, I can see the following: It looks as if the where condition is being excluded SELECT * FROM trans_test t WHERE t.`member_id` IN (1) yields the correct result. I would expect the same result from the above query. Steps to repro:
|
| Comments |
| Comment by David Thompson (Inactive) [ 2016-11-29 ] | ||||||||||||
|
The following variations do work, so the system must be trying to be smart somewhere.. | ||||||||||||
| Comment by David Thompson (Inactive) [ 2016-11-29 ] | ||||||||||||
|
I have a suspicion this is to do with aliases, if you update member_test to not have an id column the query behaves correctly (it also behaves the same whether myisam or innodb):
| ||||||||||||
| Comment by Andrew Hutchings (Inactive) [ 2016-11-29 ] | ||||||||||||
|
The reason appears to be that the initial myisam part of the query is optimized as a primary key match rather than a where condition, so there is no where condition pushed down which the cross engine processor is looking for. In the member_test2 example there are no indexes so there is a where condition to push down. Whilst I work on a solution a possible workaround is to remove the primary key from these tables. | ||||||||||||
| Comment by Andrew Hutchings (Inactive) [ 2016-11-30 ] | ||||||||||||
|
The problem was the where condition wasn't pushed down due to it being an index lookup. I have created a fix which will disable indexes whilst doing the first pass optimization but will use indexes for the cross-join execution or any query on a non-ColumnStore table. Two possible workarounds if the row count of the MyISAM table is low are to remove indexes or disable them using `USE INDEX()` after the table name in the FROM clause in the subquery. | ||||||||||||
| Comment by Daniel Lee (Inactive) [ 2016-12-02 ] | ||||||||||||
|
Build verified: Build from Github [root@localhost mariadb-columnstore-server]# git show Merge pull request #18 from mariadb-corporation/ [root@localhost mariadb-columnstore-server]# cd mariadb-columnstore-engine/ merge mcol-421 branch Verified the test case in the bug description
-----
----- |