SMALLINT Datatype has flaws
ISSUE
MapD's SMALLINT datatype has several flaws upon applied boundary conditions. To reproduce the issues, run the follow sql statements on the MapDQL cursor:
CREATE TABLE t2(id SMALLINT, val SMALLINT);
INSERT INTO T2 VALUES(1, 0);
INSERT INTO t2 VALUES(2, 32766);
INSERT INTO t2 VALUES(3, 32767);
INSERT INTO t2 VALUES(4, 32768);
INSERT INTO t2 VALUES(5, -32767);
INSERT INTO t2 VALUES(6, -32768);
INSERT INTO t2 VALUES(7, -32769);
INSERT INTO t2 VALUES(8, 9992222222222222222222);
SELECT * FROM t2;
Results from the SELECT statement
mapdql> SELECT * FROM t2;
id|val
1|0
2|32766
3|32767
4|NULL
5|-32767
6|NULL
7|32767
8|-1
Comparisons of Expected and Actual Results
id: 1 and val: 0
- Expected Results: **0** = Actual Results: **0**? -> PASS
id: 2 and val: 32766
- Expected Results: **32766** == Actual Results: **32766?**? -> PASS
id: 3 and val: 32767
- Expected Results: **32767** == Actual Results: **32767**? -> PASS
id: 4 and val: 32768:
- Expected Results: **Error Msg** == Actual Results: **NULL**?-> FAIL
id: 5 and val: -32767:
- Expected Results: **-32767** == Actual Results: **-32767**? -> PASS
id: 6 and val: -32768:
- Expected Results: **-32768** == Actual Results: **NULL**? -> FAIL
id: 7 and val: -32769:
- Expected Results: **Error Msg** == Actual Results: **32767**? -> FAIL
id: 8 and val: 9992222222222222222222
- Expected Results: **Error Msg** == Actual Results: **-1**? -> FAIL
Explanation
The SMALLINT datatype has 2 bytes in the -32768 to 32767 range. The way MapD is a detection handling to outside boundaries is incorrect and doesn't throw error exceptions. Also, Is the -1 result for the large number input part of an error?
Thanks for the detailed report! Yes, we're aware of this internally and we'll work on it very soon.
@RalphLoen @andrewseidl please take a look into the issue.
@asuhan Thanks for your reply. This week is my 2nd week at MapD.
This issue has been inactive for a while, and the project has changed substantially. If this still occurs on the latest release, please add reproduction steps and environment details.