File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -3065,6 +3065,12 @@ impl FromStr for ScalarValue {
3065
3065
}
3066
3066
}
3067
3067
3068
+ impl From < String > for ScalarValue {
3069
+ fn from ( value : String ) -> Self {
3070
+ ScalarValue :: Utf8 ( Some ( value) )
3071
+ }
3072
+ }
3073
+
3068
3074
impl From < Vec < ( & str , ScalarValue ) > > for ScalarValue {
3069
3075
fn from ( value : Vec < ( & str , ScalarValue ) > ) -> Self {
3070
3076
let ( fields, scalars) : ( SchemaBuilder , Vec < _ > ) = value
@@ -4688,6 +4694,16 @@ mod tests {
4688
4694
) ;
4689
4695
}
4690
4696
4697
+ #[ test]
4698
+ fn test_scalar_value_from_string ( ) {
4699
+ let scalar = ScalarValue :: from ( "foo" ) ;
4700
+ assert_eq ! ( scalar, ScalarValue :: Utf8 ( Some ( "foo" . to_string( ) ) ) ) ;
4701
+ let scalar = ScalarValue :: from ( "foo" . to_string ( ) ) ;
4702
+ assert_eq ! ( scalar, ScalarValue :: Utf8 ( Some ( "foo" . to_string( ) ) ) ) ;
4703
+ let scalar = ScalarValue :: from_str ( "foo" ) . unwrap ( ) ;
4704
+ assert_eq ! ( scalar, ScalarValue :: Utf8 ( Some ( "foo" . to_string( ) ) ) ) ;
4705
+ }
4706
+
4691
4707
#[ test]
4692
4708
fn test_scalar_struct ( ) {
4693
4709
let field_a = Arc :: new ( Field :: new ( "A" , DataType :: Int32 , false ) ) ;
You can’t perform that action at this time.
0 commit comments