martin-g commented on code in PR #18664:
URL: https://github.com/apache/datafusion/pull/18664#discussion_r2523425232
##########
datafusion/functions/src/crypto/md5.rs:
##########
@@ -89,30 +85,10 @@ impl ScalarUDFImpl for Md5Func {
&self.signature
}
- fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> {
- use DataType::*;
- Ok(match &arg_types[0] {
- LargeUtf8 | LargeBinary => Utf8View,
- Utf8View | Utf8 | Binary | BinaryView => Utf8View,
- Null => Null,
- Dictionary(_, t) => match **t {
- LargeUtf8 | LargeBinary => Utf8View,
- Utf8 | Binary | BinaryView => Utf8View,
- Null => Null,
- _ => {
- return plan_err!(
- "the md5 can only accept strings but got {:?}",
- **t
- );
- }
- },
- other => {
- return plan_err!(
- "The md5 function can only accept strings. Got {other}"
- );
- }
- })
+ fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType> {
+ Ok(DataType::Utf8View)
Review Comment:
Why md5 returns Utf8View ?
digest and sha return Binary
##########
datafusion/functions/src/crypto/digest.rs:
##########
@@ -109,3 +114,20 @@ impl ScalarUDFImpl for DigestFunc {
self.doc()
}
}
+
+/// Digest computes a binary hash of the given data, accepts Utf8 or LargeUtf8
and returns a [`ColumnarValue`].
+/// Second argument is the algorithm to use.
+/// Standard algorithms are md5, sha1, sha224, sha256, sha384 and sha512.
Review Comment:
```suggestion
/// Standard algorithms are md5, sha224, sha256, sha384 and sha512.
```
sha1 is not supported in sha.rs and since it is too weak it should not be
advertised
##########
datafusion/functions/src/crypto/basic.rs:
##########
@@ -17,20 +17,17 @@
//! "crypto" DataFusion functions
-use arrow::array::{
- Array, ArrayRef, BinaryArray, BinaryArrayType, BinaryViewArray,
GenericBinaryArray,
- OffsetSizeTrait,
-};
-use arrow::array::{AsArray, GenericStringArray, StringViewArray};
+use arrow::array::{Array, ArrayRef, BinaryArray, BinaryArrayType};
+use arrow::array::{AsArray, StringViewArray};
Review Comment:
nit: The two lines above could be merged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]