viirya commented on code in PR #6723:
URL: https://github.com/apache/arrow-datafusion/pull/6723#discussion_r1235810333
##########
datafusion/physical-expr/src/datetime_expressions.rs:
##########
@@ -283,6 +283,11 @@ pub fn date_trunc(args: &[ColumnarValue]) ->
Result<ColumnarValue> {
Ok(match array {
ColumnarValue::Scalar(ScalarValue::TimestampNanosecond(v, tz_opt)) => {
let nano = (f)(*v)?;
+
+ if nano.is_none() {
+ return Ok(ColumnarValue::Scalar(ScalarValue::Null));
Review Comment:
This is how `TimestampNanosecond` is defined in `enum ScalarValue`:
```
/// Timestamp Nanoseconds
TimestampNanosecond(Option<i64>, Option<Arc<str>>),
```
The first argument is `Option<i64>`. If it is a `None`, meaning that is a
null `TimestampNanosecond` scalar value.
--
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]