Skip to content

Commit 6d00734

Browse files
authored
Implement From<Option<String>>' for ScalarValue` (#17043)
`ScalarValue` can be made into from a `&str`, `Option<&str>` and `String`. `Option<String>` was a missing alternative.
1 parent 40015a8 commit 6d00734

File tree

1 file changed

+8
-2
lines changed
  • datafusion/common/src/scalar

1 file changed

+8
-2
lines changed

datafusion/common/src/scalar/mod.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4043,7 +4043,7 @@ impl From<&str> for ScalarValue {
40434043
impl From<Option<&str>> for ScalarValue {
40444044
fn from(value: Option<&str>) -> Self {
40454045
let value = value.map(|s| s.to_string());
4046-
ScalarValue::Utf8(value)
4046+
value.into()
40474047
}
40484048
}
40494049

@@ -4070,7 +4070,13 @@ impl FromStr for ScalarValue {
40704070

40714071
impl From<String> for ScalarValue {
40724072
fn from(value: String) -> Self {
4073-
ScalarValue::Utf8(Some(value))
4073+
Some(value).into()
4074+
}
4075+
}
4076+
4077+
impl From<Option<String>> for ScalarValue {
4078+
fn from(value: Option<String>) -> Self {
4079+
ScalarValue::Utf8(value)
40744080
}
40754081
}
40764082

0 commit comments

Comments
 (0)