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/06/30 16:53:14 UTC

[GitHub] [arrow-datafusion] Dandandan commented on a diff in pull request #2786: wip: Implement extract epoch

Dandandan commented on code in PR #2786:
URL: https://github.com/apache/arrow-datafusion/pull/2786#discussion_r911251574


##########
datafusion/physical-expr/src/datetime_expressions.rs:
##########
@@ -372,6 +377,40 @@ pub fn date_part(args: &[ColumnarValue]) -> Result<ColumnarValue> {
     })
 }
 
+fn extract_epoch<T>(array: &PrimitiveArray<T>) -> Result<Int32Array>
+where
+    T: ArrowTemporalType + ArrowNumericType,
+    i64: std::convert::From<T::Native>,
+{
+    let mut b = Int32Builder::new(array.len());

Review Comment:
   Note: In terms of performance (and readability), it is better to avoid the builder/`value` etc. and work directly on the values (check the arrow-rs kernels for examples).
   Ok to leave this for a future PR if you like 👍 



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