Negative decimals less than 1 erroneously converted to positive
timkpaine opened this issue · 2 comments
timkpaine commented
#[test]
fn negative_decimal_small() {
let actual = decimal_text_to_i128(b"-0.1", 5);
assert_eq!(-10000, actual);
}
assertion `left == right` failed
left: -10000
right: 10000
After pacman82/arrow-odbc@cc5d45d, this seems to break both arrow-odbc
and arrow-odbc-py
fairly seriously (all negative decimals with magnitude less than 1 converted to positive). The bug is fairly clear:
let (mut high, num_digits_high) = i128::from_radix_10_signed(text);
It is assumed high
will have a sign, but if its 0
it will not preserve the negative.
pacman82 commented
fairly seriously
True I'll try to release a fix after work
pacman82 commented
merged your PR released odbc-api
and downstream artefacts arrow-odbc
and odbc2parquet
. Short on time, but thanks for catching this.