heavydb
heavydb copied to clipboard
Incorrect import on negative numbers with no whole units
Issue Details.
neg.csv
1.00012
2.00013
-3.456
-11.34
-0.500
-.6
my test
mapdql> \d t1
CREATE TABLE t1 (
n1 DECIMAL(19,8))
mapdql> copy t1 from '/data/neg/neg.csv' with (header = 'false');
Result
Loaded: 5 recs, Rejected: 0 recs in 0.054000 secs
mapdql> select n1,n1/1000 from t1;
n1|EXPR$1
1.000120|0.001000
2.000130|0.002000
-3.456000|-0.003456
-11.340000|-0.011340
0.500000|0.000500
The issue is with any negative value with no whole unit .
Looks like the problem is in parse_numeric: https://github.com/mapd/mapd-core/blob/444e89579a82f23609596308c070ba7522af8cd9/Shared/Datum.cpp#L54-L69
Specifically there's no explicit handling for negatives, so if before_dot happens to be -0, then std::stoll("-0") returns 0