You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/11/13 05:40:43 UTC

[GitHub] [arrow-datafusion] waynexia commented on a diff in pull request #4186: Parse nanoseconds for intervals

waynexia commented on code in PR #4186:
URL: https://github.com/apache/arrow-datafusion/pull/4186#discussion_r1020839570


##########
datafusion/common/src/parsers.rs:
##########
@@ -19,8 +19,8 @@
 use crate::{DataFusionError, Result, ScalarValue};
 use std::str::FromStr;
 
-const SECONDS_PER_HOUR: f32 = 3_600_f32;
-const MILLIS_PER_SECOND: f32 = 1_000_f32;
+const SECONDS_PER_HOUR: f64 = 3_600_f64;
+const NANOS_PER_SECOND: f64 = 1_000_000_000f64;

Review Comment:
   ```suggestion
   const NANOS_PER_SECOND: f64 = 1_000_000_000_f64;
   ```
   
   nitpicking, to be consistent with another literal 😋



##########
datafusion/core/tests/sql/expr.rs:
##########
@@ -917,19 +917,19 @@ async fn test_interval_expressions() -> Result<()> {
     );
     test_expression!(
         "interval '0.499 day'",
-        "0 years 0 mons 0 days 11 hours 58 mins 33.596 secs"
+        "0 years 0 mons 0 days 11 hours 58 mins 33.600 secs"
     );
     test_expression!(
         "interval '0.4999 day'",
-        "0 years 0 mons 0 days 11 hours 59 mins 51.364 secs"
+        "0 years 0 mons 0 days 11 hours 59 mins 51.360 secs"
     );
     test_expression!(
         "interval '0.49999 day'",
         "0 years 0 mons 0 days 11 hours 59 mins 59.136 secs"
     );
     test_expression!(
         "interval '0.49999999999 day'",
-        "0 years 0 mons 0 days 12 hours 0 mins 0.00 secs"
+        "0 years 0 mons 0 days 11 hours 59 mins 59.999999136 secs"

Review Comment:
   Great improvement! 👍 



-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org