[MCOL-515] GROUP BY in a cross engine subquery generates bad results Created: 2017-01-18 Updated: 2017-08-16 Resolved: 2017-08-16 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | None |
| Affects Version/s: | 1.0.6, 1.0.7 |
| Fix Version/s: | 1.0.11, 1.1.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Andrew Hutchings (Inactive) | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Sprint: | 2017-9, 2017-15, 2017-16 | ||||||||
| Description |
|
The following SSB query fails with an empty set when dateinfo is a MyISAM table and the other tables are ColumnStore (which happens when (day of year + 2) mod 6 = 2)
Replacing the dateinfo subqueries with fixed values the query succeeds. It appears to be an issue with the CrossEngine step. |
| Comments |
| Comment by Andrew Hutchings (Inactive) [ 2017-01-18 ] | ||||||||||||||||
|
To be specific it seems that the second subquery for the BETWEEN clause being a MyISAM table causes the failure. Works fine if that table is ColumnStore even if the first BETWEEN subquery is MyISAM. | ||||||||||||||||
| Comment by Andrew Hutchings (Inactive) [ 2017-01-18 ] | ||||||||||||||||
|
Crossengine evaluates to:
Modifying the query to the following shows the subquery is returning 0 for a MyISAM table, but the correct 19980301 for a ColumnStore table:
| ||||||||||||||||
| Comment by Andrew Hutchings (Inactive) [ 2017-01-18 ] | ||||||||||||||||
|
Simplified test:
It is the group by in the cross engine subquery that breaks. | ||||||||||||||||
| Comment by Adam [ 2017-04-07 ] | ||||||||||||||||
|
Andrew, I'm running into a similar issue on 1.0.6, 1.0.7, and 1.0.8 when performing a cross engine select against a view containing a group by atop innodb tables. If I use a straight_join optimizer hint I can force the optimizer to not perform an aria temp table on disk; I get the correct result set (albeit with a query execution time of 4 sec). It is only when the optimizer decides to use a temp table on disk (aria) that the performance degrades considerably (27 sec, 10 for the temp table and 17 for sending data) and the group by result set only returns a value for the view's first pivot GROUP_CONCAT(IF()); the remaining pivot columns contain an empty string ('', not null). The same view atop innodb tables within maraidb 10.1.19, with the same explain plan using a temp table on disk returns the correct result set in under 600 ms. As I am able to get the cross engine select to run with a group by and return the correct result set; I'd be more inclined that the underlying problem is with the use of aria temp tables and the columnstore optimizer. Hope this helps. Adam | ||||||||||||||||
| Comment by Andrew Hutchings (Inactive) [ 2017-04-07 ] | ||||||||||||||||
|
Hi Adam, It sounds as though your problem may be slightly different. In this case the problem is that data is being lost between the group by and limit processor in ExeMgr when part of a cross join. Querying the non-ColumnStore tables is working fine, it is the post-processing that is failing. The performance should not be affected. In your case using straight_join might kick ColumnStore out of vtable mode (and therefore there will be temp tables) which would be considerably slower, I'm not 100% sure as I haven't tried it. Also worth noting that empty string and NULL are currently the same thing in ColumnStore. There is a feature request open to solve that one too. If you are able to put together a test case so we can reproduce your issue we can evaluate whether or not it is the same bug or open a new one if needed. Kind Regards | ||||||||||||||||
| Comment by Adam [ 2017-04-07 ] | ||||||||||||||||
|
Andrew, Thank you for the prompt response. I'll try not to hijack your bug report if this is not related. With luck the test case can reproduce the result I'm seeing and is related / helpful. I've attached a sample test case file (Columnstore_1_0_8_aria_temp_table_view_pivot_incomplete_result_set_test_case.sql). Adam | ||||||||||||||||
| Comment by Andrew Hutchings (Inactive) [ 2017-08-04 ] | ||||||||||||||||
|
Fix for 1.0 and 1.1. For QA: For Adam: | ||||||||||||||||
| Comment by Daniel Lee (Inactive) [ 2017-08-16 ] | ||||||||||||||||
|
Builds verified: 1.0.11-1 and 1.1.0 (GitHub source) /root/columnstore/mariadb-columnstore-server Merge pull request #66 from mariadb-corporation/ /root/columnstore/mariadb-columnstore-server/mariadb-columnstore-engine moved CONFIGURE option to bottom of list diff --git a/oam/oamcpp/liboamcpp.h b/oam/oamcpp/liboamcpp.h
|