slfan1989 opened a new issue, #3654:
URL: https://github.com/apache/iceberg-rust/issues/3654
### Apache Iceberg Rust version
0.10.1
### Describe the bug
`Datum::decimal_from_str` silently returns incorrect values for some finite
decimal inputs. It parses `1e3` as `1` because the positive exponent is lost
when extracting the unscaled coefficient. It also accepts a 39-digit positive
integer that exceeds Iceberg's maximum decimal precision of 38 digits and
returns a negative value.
### To Reproduce
```
use iceberg::spec::Datum;
for input in ["1e3", "170141183460469231731687303715884105729"] {
println!("{input} -> {}", Datum::decimal_from_str(input).unwrap());
}
```
Actual output
```
1e3 -> 1
170141183460469231731687303715884105729 ->
-170141183460469231731687303715884105727
```
### Expected behavior
- "1e3" should produce the same decimal datum as "1000".
- An input that exceeds the supported precision should return
`ErrorKind::DataInvalid`.
### Willingness to contribute
None
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]