alamb commented on code in PR #8411:
URL: https://github.com/apache/arrow-datafusion/pull/8411#discussion_r1416184089
##########
datafusion/common/src/scalar.rs:
##########
@@ -4645,6 +4651,16 @@ mod tests {
);
}
+ #[test]
+ fn test_scalar_value_from_string() {
+ let scalar = ScalarValue::from("foo");
+ assert_eq!(scalar, ScalarValue::Utf8(Some("foo".to_string())));
+ let scalar = ScalarValue::from("foo".to_string());
+ assert_eq!(scalar, ScalarValue::Utf8(Some("foo".to_string())));
Review Comment:
> I think the only difference is From<String> avoids copying the string
content?
It avoids copying as well as makes creating `ScalarValue`s easier to create
/ user (e.g. someone was confused as reported on
https://github.com/apache/arrow-datafusion/issues/8380)
> One tricky might be removing From<&str> implementqtion and seeing if
something fails to compile.
I tried this and found there weren't any obvious examples in the codebase --
the more common pattern is `ScalarValue::from("foo")` with a constant string
--
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]