@@ -571,7 +571,7 @@ impl SparkCastOptions {
571571            eval_mode, 
572572            timezone :  timezone. to_string ( ) , 
573573            allow_incompat, 
574-             is_adapting_schema :  false , 
574+             is_adapting_schema :  false 
575575        } 
576576    } 
577577
@@ -583,6 +583,7 @@ impl SparkCastOptions {
583583            is_adapting_schema :  false , 
584584        } 
585585    } 
586+ 
586587} 
587588
588589/// Spark-compatible cast implementation. Defers to DataFusion's cast where that is known 
@@ -2087,7 +2088,7 @@ mod tests {
20872088
20882089        let  timezone = "UTC" . to_string ( ) ; 
20892090        // test casting string dictionary array to timestamp array 
2090-         let  cast_options = SparkCastOptions :: new ( EvalMode :: Legacy ,  timezone. clone ( ) ,  false ) ; 
2091+         let  cast_options = SparkCastOptions :: new ( EvalMode :: Legacy ,  & timezone,  false ) ; 
20912092        let  result = cast_array ( 
20922093            dict_array, 
20932094            & DataType :: Timestamp ( TimeUnit :: Microsecond ,  Some ( timezone. clone ( ) . into ( ) ) ) , 
@@ -2296,7 +2297,7 @@ mod tests {
22962297    fn  test_cast_unsupported_timestamp_to_date ( )  { 
22972298        // Since datafusion uses chrono::Datetime internally not all dates representable by TimestampMicrosecondType are supported 
22982299        let  timestamps:  PrimitiveArray < TimestampMicrosecondType >  = vec ! [ i64 :: MAX ] . into ( ) ; 
2299-         let  cast_options = SparkCastOptions :: new ( EvalMode :: Legacy ,  "UTC" . to_string ( ) ,  false ) ; 
2300+         let  cast_options = SparkCastOptions :: new ( EvalMode :: Legacy ,  "UTC" ,  false ) ; 
23002301        let  result = cast_array ( 
23012302            Arc :: new ( timestamps. with_timezone ( "Europe/Copenhagen" ) ) , 
23022303            & DataType :: Date32 , 
@@ -2309,7 +2310,7 @@ mod tests {
23092310    fn  test_cast_invalid_timezone ( )  { 
23102311        let  timestamps:  PrimitiveArray < TimestampMicrosecondType >  = vec ! [ i64 :: MAX ] . into ( ) ; 
23112312        let  cast_options =
2312-             SparkCastOptions :: new ( EvalMode :: Legacy ,  "Not a valid timezone" . to_string ( ) ,  false ) ; 
2313+             SparkCastOptions :: new ( EvalMode :: Legacy ,  "Not a valid timezone" ,  false ) ; 
23132314        let  result = cast_array ( 
23142315            Arc :: new ( timestamps. with_timezone ( "Europe/Copenhagen" ) ) , 
23152316            & DataType :: Date32 , 
@@ -2335,7 +2336,7 @@ mod tests {
23352336        let  string_array = cast_array ( 
23362337            c, 
23372338            & DataType :: Utf8 , 
2338-             & SparkCastOptions :: new ( EvalMode :: Legacy ,  "UTC" . to_owned ( ) ,  false ) , 
2339+             & SparkCastOptions :: new ( EvalMode :: Legacy ,  "UTC" ,  false ) , 
23392340        ) 
23402341        . unwrap ( ) ; 
23412342        let  string_array = string_array. as_string :: < i32 > ( ) ; 
@@ -2400,10 +2401,9 @@ mod tests {
24002401        let  cast_array = spark_cast ( 
24012402            ColumnarValue :: Array ( c) , 
24022403            & DataType :: Struct ( fields) , 
2403-             EvalMode :: Legacy , 
2404+             & SparkCastOptions :: new ( EvalMode :: Legacy , 
24042405            "UTC" , 
2405-             false , 
2406-             false , 
2406+             false ) 
24072407        ) 
24082408        . unwrap ( ) ; 
24092409        if  let  ColumnarValue :: Array ( cast_array)  = cast_array { 
0 commit comments