@@ -22,7 +22,7 @@ use arrow_array::{ArrayRef, Int32Array, Int64Array, StringArray};
22
22
use datafusion:: functions:: crypto:: { sha224, sha256, sha384, sha512} ;
23
23
use datafusion_common:: cast:: as_binary_array;
24
24
use datafusion_common:: { exec_err, internal_err, DataFusionError , ScalarValue } ;
25
- use datafusion_expr:: { ColumnarValue , ScalarFunctionImplementation } ;
25
+ use datafusion_expr:: { ColumnarValue , ScalarUDF } ;
26
26
use std:: sync:: Arc ;
27
27
28
28
/// Spark compatible murmur3 hash (just `hash` in Spark) in vectorized execution fashion
@@ -115,31 +115,31 @@ pub fn spark_xxhash64(args: &[ColumnarValue]) -> Result<ColumnarValue, DataFusio
115
115
116
116
/// `sha224` function that simulates Spark's `sha2` expression with bit width 224
117
117
pub fn spark_sha224 ( args : & [ ColumnarValue ] ) -> Result < ColumnarValue , DataFusionError > {
118
- wrap_digest_result_as_hex_string ( args, sha224 ( ) . fun ( ) )
118
+ wrap_digest_result_as_hex_string ( args, sha224 ( ) )
119
119
}
120
120
121
121
/// `sha256` function that simulates Spark's `sha2` expression with bit width 0 or 256
122
122
pub fn spark_sha256 ( args : & [ ColumnarValue ] ) -> Result < ColumnarValue , DataFusionError > {
123
- wrap_digest_result_as_hex_string ( args, sha256 ( ) . fun ( ) )
123
+ wrap_digest_result_as_hex_string ( args, sha256 ( ) )
124
124
}
125
125
126
126
/// `sha384` function that simulates Spark's `sha2` expression with bit width 384
127
127
pub fn spark_sha384 ( args : & [ ColumnarValue ] ) -> Result < ColumnarValue , DataFusionError > {
128
- wrap_digest_result_as_hex_string ( args, sha384 ( ) . fun ( ) )
128
+ wrap_digest_result_as_hex_string ( args, sha384 ( ) )
129
129
}
130
130
131
131
/// `sha512` function that simulates Spark's `sha2` expression with bit width 512
132
132
pub fn spark_sha512 ( args : & [ ColumnarValue ] ) -> Result < ColumnarValue , DataFusionError > {
133
- wrap_digest_result_as_hex_string ( args, sha512 ( ) . fun ( ) )
133
+ wrap_digest_result_as_hex_string ( args, sha512 ( ) )
134
134
}
135
135
136
136
// Spark requires hex string as the result of sha2 functions, we have to wrap the
137
137
// result of digest functions as hex string
138
138
fn wrap_digest_result_as_hex_string (
139
139
args : & [ ColumnarValue ] ,
140
- digest : ScalarFunctionImplementation ,
140
+ digest : Arc < ScalarUDF > ,
141
141
) -> Result < ColumnarValue , DataFusionError > {
142
- let value = digest ( args) ?;
142
+ let value = digest. invoke ( args) ?;
143
143
match value {
144
144
ColumnarValue :: Array ( array) => {
145
145
let binary_array = as_binary_array ( & array) ?;
0 commit comments