[MCOL-5568] Columnstore query returns incorrect value instead of expected out-of-range error Created: 2023-09-06 Updated: 2023-12-21 Resolved: 2023-12-14 |
|
| Status: | Closed |
| Project: | MariaDB ColumnStore |
| Component/s: | None |
| Affects Version/s: | 6.4.6, 22.08.8 |
| Fix Version/s: | 23.10.1 |
| Type: | Bug | Priority: | Major |
| Reporter: | Edward Stoever | Assignee: | Sergey Zefirov |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | rm_invalid_data, triage | ||
| Sprint: | 2023-11 |
| Assigned for Review: | |
| Assigned for Testing: | |
| Description |
|
The multiplication produces an incorrect value.
|
| Comments |
| Comment by Roman [ 2023-09-22 ] | |||||||||
|
MDB promotes the mult type into UNSIGNED BIGINT however their mult processing checks if the signed column value is negative or not. If it is there is an error that is propagated upwards. MCS math processing lacks error propagation. | |||||||||
| Comment by Leonid Fedorov [ 2023-09-22 ] | |||||||||
|
BTW query can be rewritten
---------------
--------------- | |||||||||
| Comment by Roman [ 2023-09-23 ] | |||||||||
|
Here are some comments on how does type coercion happens in MDB/MySQL: ``` | |||||||||
| Comment by Kirill Perov [ 2023-11-01 ] | |||||||||
|
1. ---------------
---------------
--------------- I have expected it should give error according to: "If both operands are integers and any of them are unsigned, the result is an unsigned integer." But both MCS and MDB shows -10 as result here. 2. In non strict mode if out-of-range value is inserted and truncated, MDB shows 1 warning: and MCS shows 2 warnings 3. For DECIMAL UNSIGNED, FLOAT UNSIGNED and DOUBLE UNSIGNED both MDB and MCS shows -10 as result, no error. | |||||||||
| Comment by Roman [ 2023-11-02 ] | |||||||||
|
Right, integer operands division produces float. Could you elaborate on whether integer division actually truncates for the 2nd scenario in your prev comment kirill.perov@mariadb.com? | |||||||||
| Comment by Kirill Perov [ 2023-11-02 ] | |||||||||
|
drrtuy Second scenario was about insertion of values > 256 into tinyint unsigned column. MariaDB [coltest]> select indemnity_paid, n_clms, indemnity_paid / n_clms from test_mult;
---------------
--------------- No errors or warnings there. | |||||||||
| Comment by Kirill Perov [ 2023-11-15 ] | |||||||||
|
testing finished ok |