waitingkuo commented on code in PR #4054:
URL: https://github.com/apache/arrow-datafusion/pull/4054#discussion_r1010319328


##########
datafusion/physical-expr/src/datetime_expressions.rs:
##########
@@ -200,6 +200,20 @@ pub fn make_current_date(
     move |_arg| Ok(ColumnarValue::Scalar(ScalarValue::Date32(days)))
 }
 
+/// Create an implementation of `current_time()` that always returns the
+/// specified current time.
+///
+/// The semantics of `current_time()` require it to return the same value
+/// wherever it appears within a single statement. This value is
+/// chosen during planning time.
+pub fn make_current_time(
+    now_ts: DateTime<Utc>,
+) -> impl Fn(&[ColumnarValue]) -> Result<ColumnarValue> {
+    let nano =
+        Some(now_ts.timestamp_nanos() % 86400000000000);
+    move |_arg| Ok(ColumnarValue::Scalar(ScalarValue::Time64(nano)))

Review Comment:
   👍 



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