alamb commented on code in PR #18664:
URL: https://github.com/apache/datafusion/pull/18664#discussion_r2561224760
##########
datafusion/functions/src/crypto/basic.rs:
##########
@@ -232,9 +184,21 @@ macro_rules! digest_to_array {
Arc::new(binary_array)
}};
}
+
+macro_rules! digest_to_scalar {
+ ($METHOD: ident, $INPUT:expr) => {{
+ ScalarValue::Binary($INPUT.as_ref().map(|v| {
+ let mut digest = $METHOD::default();
+ digest.update(v);
+ #[allow(deprecated)]
Review Comment:
I tried removing this `#[allow(deprecated)]` annotation locally and clippy
still passed
##########
datafusion/functions/src/crypto/mod.rs:
##########
@@ -23,16 +23,13 @@ use std::sync::Arc;
pub mod basic;
pub mod digest;
pub mod md5;
-pub mod sha224;
-pub mod sha256;
-pub mod sha384;
-pub mod sha512;
+pub mod sha;
Review Comment:
i think technically this is a breaking API change, but not likely to cause
major problems. I tagged this PR as an API change so it shows up in the release
notes
##########
datafusion/functions/src/crypto/digest.rs:
##########
@@ -36,16 +38,16 @@ use std::any::Any;
syntax_example = "digest(expression, algorithm)",
sql_example = r#"```sql
> select digest('foo', 'sha256');
-+------------------------------------------+
-| digest(Utf8("foo"), Utf8("sha256")) |
-+------------------------------------------+
-| <binary_hash_result> |
-+------------------------------------------+
++------------------------------------------------------------------+
Review Comment:
I double checked this is indeed the output
```sql
DataFusion CLI v51.0.0
> select digest('foo', 'sha256');
+------------------------------------------------------------------+
| digest(Utf8("foo"),Utf8("sha256")) |
+------------------------------------------------------------------+
| 2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae |
+------------------------------------------------------------------+
1 row(s) fetched.
Elapsed 0.030 seconds.
```
##########
datafusion/functions/src/crypto/basic.rs:
##########
@@ -232,9 +184,21 @@ macro_rules! digest_to_array {
Arc::new(binary_array)
}};
}
+
+macro_rules! digest_to_scalar {
+ ($METHOD: ident, $INPUT:expr) => {{
+ ScalarValue::Binary($INPUT.as_ref().map(|v| {
+ let mut digest = $METHOD::default();
+ digest.update(v);
+ #[allow(deprecated)]
Review Comment:
```suggestion
```
--
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]