gruuya commented on PR #8700:
URL: https://github.com/apache/arrow-rs/pull/8700#issuecomment-3901573683

   > Late drive-by -- it's not obvious to me whether the parsing truncates or 
rounds a number like `1.9` and all of the unit tests have fractional parts less 
than 0.5. Based on my quick skim of the code not turning up any obvious 
references to rounding, I assume it truncates. But is that the desired behavior?
   
   Yes, it will truncate it, i.e. this passes
   ```rust
   assert_eq!(
       parse_decimal::<Decimal128Type>("1.9", 3, 0).unwrap(),
       1,
   );
   ```
   
   It's a valid question on what is the expected outcome here, for instance PG 
will actually round it up
   ```sql
   postgres@localhost:postgres> select '1.9'::numeric(3, 0);
   +---------+
   | numeric |
   |---------|
   | 2       |
   +---------+
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to