scovich commented on code in PR #7785:
URL: https://github.com/apache/arrow-rs/pull/7785#discussion_r2167831230


##########
parquet-variant/src/to_json.rs:
##########
@@ -42,50 +42,6 @@ fn format_binary_base64(bytes: &[u8]) -> String {
     general_purpose::STANDARD.encode(bytes)
 }
 
-/// Write decimal using scovich's hybrid approach for i32
-fn write_decimal_i32(
-    json_buffer: &mut impl Write,
-    integer: i32,
-    scale: u8,
-) -> Result<(), ArrowError> {
-    let integer = if scale == 0 {
-        integer
-    } else {
-        let divisor = 10_i32.pow(scale as u32);
-        if integer % divisor != 0 {
-            // fall back to floating point
-            let result = integer as f64 / divisor as f64;
-            write!(json_buffer, "{}", result)?;
-            return Ok(());
-        }
-        integer / divisor
-    };
-    write!(json_buffer, "{}", integer)?;
-    Ok(())
-}
-
-/// Write decimal using scovich's hybrid approach for i64
-fn write_decimal_i64(
-    json_buffer: &mut impl Write,
-    integer: i64,
-    scale: u8,
-) -> Result<(), ArrowError> {
-    let integer = if scale == 0 {
-        integer
-    } else {
-        let divisor = 10_i64.pow(scale as u32);
-        if integer % divisor != 0 {
-            // fall back to floating point
-            let result = integer as f64 / divisor as f64;
-            write!(json_buffer, "{}", result)?;
-            return Ok(());

Review Comment:
   My original suggestion to use this logic was for the 
`serde_json::Value::Number` code path, which can only support i64, u64, and f64 
values. Normal to-string can use arbitrary precision -- let the reader be the 
one to lose information (if it must).



-- 
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