[MCOL-254] ColumnStore is limited to two columns in a GROUP BY statement. Created: 2016-07-15 Updated: 2016-08-23 Resolved: 2016-08-23 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | ExeMgr |
| Affects Version/s: | None |
| Fix Version/s: | 1.0.2 |
| Type: | Bug | Priority: | Major |
| Reporter: | David Hill (Inactive) | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Sprint: | 1.0.2-2 |
| Description |
|
Reported by an alpha customer: Today’s issue, is that my developer is having some issues with GROUP BY statements, and seems to think that ColumnStore is limited to two columns in a GROUP BY statement. The documentation suggests that there’s a 10-column maximum on this page https://mariadb.com/kb/en/mariadb/columnstore-select/ I get this error: For the following select statement. SELECT This is somewhat of a showstopper for us, if this is a bug (which I suspect it might be). The table schema is as follows: CREATE TABLE `output_cod_single_year_v265` ( |
| Comments |
| Comment by David Hill (Inactive) [ 2016-07-15 ] |
|
info from D lee I tried it. It did not work. this syntax is ok SELECT but as soon as I add another column in the where clause, it errors out MariaDB [mytest]> SELECT Putting () around the columns in the where clause did not help. |
| Comment by David Hill (Inactive) [ 2016-07-15 ] |
|
customer reported this worked in infinidb |
| Comment by David Hall (Inactive) [ 2016-08-09 ] |
|
A test shows that this does indeed appear to work in InfiniDB |
| Comment by David Hall (Inactive) [ 2016-08-09 ] |
|
This similar query works fine against tpch: By paring the where clause in the reporter's query to just one = statement, it works. Adding another = statement breaks it. The IN clauses seem to not be an issue. However this statement with three where conditions works. By removing just one of the fields from the original query, it works with two where conditions. Seems there's some sort of heterodyning between the number of group by conditions and the number of where conditions. |
| Comment by David Hall (Inactive) [ 2016-08-18 ] |
|
The optimizer sees items in the where clause that are basically compares against a constant – IN with one value is treated as a constant. It then decides that having a group by clause for this field is a waste of time and optimizes it out. Columnstore doesn't know it got optimized out and complains about the lack of a group by for that field. WHERE measure_id IN(1) Are both optimized out and cause the issue. WHERE measure_id IN(1,2) |
| Comment by David Hall (Inactive) [ 2016-08-19 ] |
|
During the changes from mysql 5.1.73 and mariadb 10.1, the optimizer was changed – an added call to remove_const was added. remove_const is a function written for ORDER BY and was repurposed for GROUP BY. It's supposed to remove any duplicate phrases and optimize out any GROUP BY that have a corresponding constant WHERE clause. The Columnstore Engine edits to be sure there is a GROUP BY for every non aggregated return column. I don't know what happens if this edit is taken out. InfiniDB put a 'if !InfiniDB' statement around the previously existing call to remove_const, so I added such a check to the new call. |
| Comment by Andrew Hutchings (Inactive) [ 2016-08-19 ] |
|
Looks good to me, approved. Also good catch with the README fix. Moving to Daniel for QA |
| Comment by Dipti Joshi (Inactive) [ 2016-08-23 ] |
|
dleeyh Has this been QAed and added to AutoPilot ? |
| Comment by Daniel Lee (Inactive) [ 2016-08-23 ] |
|
Verified the query from the user. |