Jefffrey opened a new issue, #5045:
URL: https://github.com/apache/arrow-rs/issues/5045

   **Describe the bug**
   <!--
   A clear and concise description of what the bug is.
   -->
   
   Floats and doubles that are zero (or negative zero) are displayed in format 
`0E0` for `Field` from record api
   
   **To Reproduce**
   <!--
   Steps to reproduce the behavior:
   -->
   
   In unit test:
   
https://github.com/apache/arrow-rs/blob/91acfb07a9929a2d6721c5417e47c0c472372a86/parquet/src/record/api.rs#L1148-L1158
   
   Modify to add new case:
   ```rust
       #[test]
       fn test_convert_float_to_string() {
           assert_eq!(format!("{}", Field::Float(1.0)), "1.0");
           assert_eq!(format!("{}", Field::Float(9.63)), "9.63");
           assert_eq!(format!("{}", Field::Float(1e-15)), "0.000000000000001");
           assert_eq!(format!("{}", Field::Float(1e-16)), "1E-16");
           assert_eq!(format!("{}", Field::Float(1e19)), 
"10000000000000000000.0");
           assert_eq!(format!("{}", Field::Float(1e20)), "1E20");
           assert_eq!(format!("{}", Field::Float(1.7976931E30)), 
"1.7976931E30");
           assert_eq!(format!("{}", Field::Float(-1.7976931E30)), 
"-1.7976931E30");
           assert_eq!(format!("{}", Field::Float(0.0)), "0.0"); // new test 
case, should succeed
       }
   ```
   
   Running test will fail:
   
   ```sh
   parquet$ cargo test --lib record::api::tests::test_convert_float_to_string 
-- --exact
       Finished test [unoptimized + debuginfo] target(s) in 0.06s
        Running unittests src/lib.rs 
(/media/jeffrey/1tb_860evo_ssd/.cargo_target_cache/debug/deps/parquet-b466af98c7f74484)
   
   running 1 test
   test record::api::tests::test_convert_float_to_string ... FAILED
   
   failures:
   
   ---- record::api::tests::test_convert_float_to_string stdout ----
   thread 'record::api::tests::test_convert_float_to_string' panicked at 
parquet/src/record/api.rs:1158:9:
   assertion `left == right` failed
     left: "0E0"
    right: "0.0"
   note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
   
   
   failures:
       record::api::tests::test_convert_float_to_string
   
   test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 616 filtered 
out; finished in 0.00s
   
   error: test failed, to rerun pass `--lib`
   ```
   
   **Expected behavior**
   <!--
   A clear and concise description of what you expected to happen.
   -->
   Test case succeeds
   
   **Additional context**
   <!--
   Add any other context about the problem here.
   -->


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