jayzhan211 commented on code in PR #13466:
URL: https://github.com/apache/datafusion/pull/13466#discussion_r1846520457


##########
datafusion/functions/src/datetime/date_part.rs:
##########
@@ -223,6 +233,30 @@ impl ScalarUDFImpl for DatePartFunc {
     }
 }
 
+fn is_integar_part(part: &str) -> bool {
+    let part = part_normalization(part);
+    matches!(
+        part.to_lowercase().as_str(),
+        "year"
+            | "month"
+            | "week"
+            | "day"
+            | "hour"
+            | "minute"
+            | "qtr"
+            | "quarter"
+            | "doy"
+            | "dow"

Review Comment:
   ```rust
   (secs as f64 + ((subsecs % 1_000_000_000) as f64 / 1_000_000_000_f64))
                           * sf
   ```
   
   Probably we still need f64 for seconds



##########
datafusion/functions/src/datetime/date_part.rs:
##########
@@ -223,6 +233,30 @@ impl ScalarUDFImpl for DatePartFunc {
     }
 }
 
+fn is_integar_part(part: &str) -> bool {
+    let part = part_normalization(part);
+    matches!(
+        part.to_lowercase().as_str(),
+        "year"
+            | "month"
+            | "week"
+            | "day"
+            | "hour"
+            | "minute"
+            | "qtr"
+            | "quarter"
+            | "doy"
+            | "dow"

Review Comment:
   ```rust
   let r: Float64Array = secs
               .iter()
               .zip(subsecs)
               .map(|(secs, subsecs)| {
                   secs.map(|secs| {
                       let subsecs = subsecs.unwrap_or(0);
                       (secs as f64 + ((subsecs % 1_000_000_000) as f64 / 
1_000_000_000_f64))
                           * sf
                   })
               })
               .collect();
   ```
   
   Probably we still need f64 for seconds



-- 
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-unsubscr...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to