[MCOL-1716] GROUP BY handler incorrectly process filters with subquery as IN predicate Created: 2018-09-12 Updated: 2018-11-27 Resolved: 2018-11-27 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | None |
| Affects Version/s: | 1.2 |
| Fix Version/s: | 1.2.2 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Roman | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Sprint: | 2018-17, 2018-18, 2018-19, 2018-20 | ||||||||||||||||
| Description |
|
The handler builds an incorrect execution plan and the mentioned type of queries returns incorrect results. Here are a number of examples with their counterparts taken when vtable is enabled.
|
| Comments |
| Comment by Roman [ 2018-09-12 ] | ||||||||||||||||
|
MCS transforms (NOT) IN predicate into (NOT) EXISTS internally. GROUP BY doesn't set NOT properly so 1st and 3d cases have teh same reason. The second case is different since InSub::transform() calls getSelectPlan that lacks needed information in MariaDB structures. It's worth to note the server's optimizer makes condition push prior the GROUP BY handler creation. It must contain the needed info. | ||||||||||||||||
| Comment by Roman [ 2018-11-25 ] | ||||||||||||||||
|
Please review. | ||||||||||||||||
| Comment by Roman [ 2018-11-25 ] | ||||||||||||||||
|
The proposed fix solves 1st and 3d cases. | ||||||||||||||||
| Comment by Daniel Lee (Inactive) [ 2018-11-27 ] | ||||||||||||||||
|
Build verified: 2018-11-26 nightly, Lentos 7 RPM MariaDB [mytest]> create table cs1(i bigint) engine=columnstore; MariaDB [mytest]> create table cs2(i bigint) engine=columnstore; MariaDB [mytest]> insert into cs1 values (10),(20),(30); MariaDB [mytest]> insert into cs2 values (10),(21),(30); MariaDB [mytest]> set infinidb_vtable_mode=1; MariaDB [mytest]> select sum
--------
-------- MariaDB [mytest]> set infinidb_vtable_mode=0; MariaDB [mytest]> select sum
--------
-------- MariaDB [mytest]> show tables;
------------------
------------------ MariaDB [mytest]> create table orderkeys (okey int) engine=columnstore; MariaDB [mytest]> insert into orderkeys select o_orderkey from orders where o_orderkey < 1000; MariaDB [mytest]> select sum(okey) from orderkeys;
-----------
----------- MariaDB [mytest]> select sum(o_orderkey) from orders;
-----------------
----------------- MariaDB [mytest]> select sum(o_orderkey) from orders where o_orderkey not in (select okey from orderkeys);
-----------------
----------------- MariaDB [mytest]> set infinidb_vtable_mode=1; MariaDB [mytest]> select sum(o_orderkey) from orders where o_orderkey not in (select okey from orderkeys);
-----------------
----------------- |