itsjunetime commented on code in PR #11958:
URL: https://github.com/apache/datafusion/pull/11958#discussion_r1714422662
##########
datafusion/functions/src/datetime/common.rs:
##########
@@ -227,46 +229,34 @@ where
// if the first argument is a scalar utf8 all arguments are expected
to be scalar utf8
ColumnarValue::Scalar(scalar) => match scalar {
ScalarValue::Utf8(a) | ScalarValue::LargeUtf8(a) => {
- let mut val: Option<Result<ColumnarValue>> = None;
- let mut err: Option<DataFusionError> = None;
+ let a = a.as_ref();
+ // ASK: Why do we trust `a` to be non-null at this point?
Review Comment:
Previously, in this code path, if `a` was None, then the `err` that we
unwrap later down in that same block would also be None, causing a more
confusing error. So since we're comfortable unwrapping the err later on, we
must be confident `a` is `Some(_)`.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]