[MCOL-730] cross engine join query select on decimal bad precision/scale Created: 2017-05-30 Updated: 2020-08-25 Resolved: 2017-06-02 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | ExeMgr |
| Affects Version/s: | 1.0.9 |
| Fix Version/s: | 1.0.10, 1.1.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | David Thompson (Inactive) | Assignee: | Daniel Lee (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | community | ||
| Issue Links: |
|
||||||||
| Sprint: | 2017-11 | ||||||||
| Description |
|
This is a minimal test case to reproduce the behavior:
|
| Comments |
| Comment by David Thompson (Inactive) [ 2017-05-30 ] | |||||||||||||||
|
This appears to be tied up in the 18 digit limitation for columnstore decimals as if you change salary to be decimal(12,6) in the table definition then the query works. | |||||||||||||||
| Comment by David Thompson (Inactive) [ 2017-06-01 ] | |||||||||||||||
|
It actually looks like there is a larger issue with handling of decimal columns across cross engine join: CREATE TABLE employees ( CREATE TABLE roles ( – Result: salary values: (0.0500, 0.0500, 0.0100) – Result: SUM(salary): (0.0500, 0.0100). The value 2.0000 is ignored. If you change the DECIMAL specification, there are some values that work, such as DECIMAL(6,2) or DECIMAL(7,4). Does it make any sense? | |||||||||||||||
| Comment by David Thompson (Inactive) [ 2017-06-01 ] | |||||||||||||||
|
A workaround for now is to switch the innodb column type from decimal to double. | |||||||||||||||
| Comment by David Thompson (Inactive) [ 2017-06-01 ] | |||||||||||||||
|
We should consider a proper fix for this rather than erroring. | |||||||||||||||
| Comment by Andrew Hutchings (Inactive) [ 2017-06-02 ] | |||||||||||||||
|
The cause is a bad precision/scale for the result column, the fix is to use the precision/scale from the cross engine results instead. | |||||||||||||||
| Comment by Andrew Hutchings (Inactive) [ 2017-06-02 ] | |||||||||||||||
|
Pull request for 1.0 and 1.1. The pull requests are slightly different as 1.0 uses libdrizzle whereas 1.1 uses MairaDB Connector/C | |||||||||||||||
| Comment by Daniel Lee (Inactive) [ 2017-06-02 ] | |||||||||||||||
|
Builds verified: Github source 1.0.10, 1.1.0 1.0.10 [root@localhost mariadb-columnstore-server]# git show [root@localhost mariadb-columnstore-engine]# git show 1.1.0 [root@localhost mariadb-columnstore-engine]# git show [root@localhost ~]# mcsmysql mytest Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MariaDB [mytest]> CREATE TABLE employees ( MariaDB [mytest]> MariaDB [mytest]> INSERT INTO employees (`id`, `name`) VALUES (1, 'John'), (2, 'Mary'); MariaDB [mytest]> INSERT INTO roles (`employee_id`, `role`, `salary`) VALUES (1, 'Programmer', 3.33), (2, 'DBA', 4.57); MariaDB [mytest]> SELECT * FROM roles;
------------
------------ MariaDB [mytest]> SELECT name, salary FROM employees JOIN roles on employees.id = roles.employee_id;
-----
----- |