viirya commented on code in PR #6723:
URL: https://github.com/apache/arrow-datafusion/pull/6723#discussion_r1234479074


##########
datafusion/physical-expr/src/datetime_expressions.rs:
##########
@@ -287,31 +287,31 @@ pub fn date_trunc(args: &[ColumnarValue]) -> 
Result<ColumnarValue> {
                 "minute" => {
                     // trunc to minute
                     let second = ScalarValue::TimestampNanosecond(
-                        Some(nano.unwrap() / 1_000_000_000 * 1_000_000_000),
+                        Some(nano.unwrap_or_default() / 1_000_000_000 * 
1_000_000_000),

Review Comment:
   Currently  in `date_trunc`, `nano` is assumed to be `Some`. To return null 
for null input instead of `unwrap` on it, we can simply return a null timestamp 
scalar if `nano` is None.



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