Jefffrey commented on code in PR #24057:
URL: https://github.com/apache/datafusion/pull/24057#discussion_r3771997671


##########
datafusion/functions/src/encoding/inner.rs:
##########
@@ -373,7 +373,11 @@ impl Encoding {
         match self {
             Self::Base64 => BASE64_ENGINE.encode(value),
             Self::Base64Padded => BASE64_ENGINE_PADDED.encode(value),
-            Self::Hex => encode_hex(value, HexCase::Lower),
+            Self::Hex => {
+                let mut out = Vec::with_capacity(value.len() * 2);
+                encode_bytes_into(value, HexCase::Lower, &mut out);
+                unsafe { String::from_utf8_unchecked(out) }

Review Comment:
   e.g. here we can still keep `encode_bytes`



##########
datafusion/common/src/utils/hex.rs:
##########
@@ -161,6 +161,9 @@ pub fn encode_bytes_to_slice(bytes: &[u8], case: HexCase, 
out: &mut [u8]) -> Res
 
 /// Returns the hex encoding of `bytes` as an owned `String`.
 ///
+/// Prefer [`encode_bytes_into`] when you already have a reusable output 
buffer.
+#[deprecated(note = "use encode_bytes_into or encode_bytes_to_slice instead")]

Review Comment:
   i do wonder if we should be deprecating this, as it seems theres still some 
places that would benefit from it, e.g. scalar path of md5



-- 
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]

Reply via email to