andygrove commented on code in PR #3189:
URL: https://github.com/apache/arrow-datafusion/pull/3189#discussion_r949578951
##########
datafusion/common/src/scalar.rs:
##########
@@ -726,6 +726,24 @@ impl ScalarValue {
}
}
+ /// whether this value is true or not.
+ pub fn is_true(&self) -> bool {
+ match self {
+ ScalarValue::Boolean(v) => v.eq(&Some(true)),
+ ScalarValue::Null => false,
+ other => panic!("Cannot apply 'IS TRUE' to arguments of type '{}
IS TRUE'. Supported form(s): '<BOOLEAN> IS TRUE'", other)
Review Comment:
This code is called from `IsTrueExpr.evaluate`, which returns a `Result`. I
think we should move this logic out of `ScalarValue` and have it in
`IsTrueExpr` so that we can return an `Err` and avoid a `panic!`.
--
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]