ftelnov commented on code in PR #2299:
URL: https://github.com/apache/avro/pull/2299#discussion_r1239713747
##########
lang/rust/avro/src/decimal.rs:
##########
@@ -53,6 +52,40 @@ impl Decimal {
decimal_bytes[start_byte_index..].copy_from_slice(&raw_bytes);
Ok(decimal_bytes)
}
+
+ fn from_bigint(bigint: BigInt) -> Self {
+ let len = (bigint.bits() as f64 / 8.0).ceil() as usize;
+ Self { value: bigint, len }
+ }
+
+ // NOTE: conversion implementations below might be not that performant.
+ // It might be best to rewrite them using bits extraction and float number
unpacking.
+
+ /// Converts from f32 by converting number to string firstly, then parsing
it.
+ pub(crate) fn try_from_f32(num: f32) -> Result<Self, DecimalParsingError> {
+ if !num.is_finite() {}
Review Comment:
Oh, wasn't completed somewhy. Fixed - it's simply a check for malformed float
--
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]