(
value: &ColumnarValue,
digest_algorithm: DigestAlgorithm,
)
| 185 | } |
| 186 | |
| 187 | pub(crate) fn digest_process( |
| 188 | value: &ColumnarValue, |
| 189 | digest_algorithm: DigestAlgorithm, |
| 190 | ) -> Result<ColumnarValue> { |
| 191 | match value { |
| 192 | ColumnarValue::Array(a) => { |
| 193 | let output = match a.data_type() { |
| 194 | DataType::Utf8View => { |
| 195 | digest_algorithm.digest_utf8_array_impl(&a.as_string_view()) |
| 196 | } |
| 197 | DataType::Utf8 => { |
| 198 | digest_algorithm.digest_utf8_array_impl(&a.as_string::<i32>()) |
| 199 | } |
| 200 | DataType::LargeUtf8 => { |
| 201 | digest_algorithm.digest_utf8_array_impl(&a.as_string::<i64>()) |
| 202 | } |
| 203 | DataType::Binary => { |
| 204 | digest_algorithm.digest_binary_array_impl(&a.as_binary::<i32>()) |
| 205 | } |
| 206 | DataType::LargeBinary => { |
| 207 | digest_algorithm.digest_binary_array_impl(&a.as_binary::<i64>()) |
| 208 | } |
| 209 | DataType::BinaryView => { |
| 210 | digest_algorithm.digest_binary_array_impl(&a.as_binary_view()) |
| 211 | } |
| 212 | other => { |
| 213 | return exec_err!( |
| 214 | "Unsupported data type {other:?} for function {digest_algorithm}" |
| 215 | ); |
| 216 | } |
| 217 | }; |
| 218 | Ok(ColumnarValue::Array(output)) |
| 219 | } |
| 220 | ColumnarValue::Scalar(scalar) => { |
| 221 | match scalar { |
| 222 | ScalarValue::Utf8View(a) |
| 223 | | ScalarValue::Utf8(a) |
| 224 | | ScalarValue::LargeUtf8(a) => Ok(digest_algorithm |
| 225 | .digest_scalar(a.as_ref().map(|s: &String| s.as_bytes()))), |
| 226 | ScalarValue::Binary(a) |
| 227 | | ScalarValue::LargeBinary(a) |
| 228 | | ScalarValue::BinaryView(a) => Ok(digest_algorithm |
| 229 | .digest_scalar(a.as_ref().map(|v: &Vec<u8>| v.as_slice()))), |
| 230 | other => exec_err!( |
| 231 | "Unsupported data type {other:?} for function {digest_algorithm}" |
| 232 | ), |
| 233 | } |
| 234 | } |
| 235 | } |
| 236 | } |
no test coverage detected
searching dependent graphs…