Chen-Yuan-Lai commented on code in PR #14826:
URL: https://github.com/apache/datafusion/pull/14826#discussion_r1988897840


##########
datafusion/functions/src/crypto/sha512.rs:
##########
@@ -52,11 +56,16 @@ impl Default for SHA512Func {
 
 impl SHA512Func {
     pub fn new() -> Self {
-        use DataType::*;
         Self {
-            signature: Signature::uniform(
-                1,
-                vec![Utf8View, Utf8, LargeUtf8, Binary, LargeBinary],
+            signature: Signature::one_of(
+                vec![
+                    TypeSignature::Coercible(vec![Coercion::new_exact(

Review Comment:
   I met another error after I used new_`new_implicit` 😭 
   ```bash
   External error: query failed: DataFusion error: Arrow error: Compute error: 
Internal Error: Cannot cast BinaryView to BinaryArray of expected type
   [SQL] select sha512(ascii_1) from test_basic_operator;
   at test_files/string/./string_query.slt.part:1732
   at test_files/string/dictionary_utf8.slt:58
   ```
   
   I think the error came from `arrow-rs`
   
https://github.com/apache/arrow-rs/blob/5b04ca7bf756c5ca9edfba220060017684e2ecc6/arrow-cast/src/cast/dictionary.rs#L107-#L128
   ```rust
   BinaryView => {
               // `unpack_dictionary` can handle Utf8View/BinaryView types, but 
incurs unnecessary data copy of the value buffer.
               // we handle it here to avoid the copy.
               let dict_array = array
                   .as_dictionary::<K>()
                   .downcast_dict::<BinaryArray>()
                   .ok_or_else(|| {
                       ArrowError::ComputeError(
                           "Internal Error: Cannot cast BinaryView to 
BinaryArray of expected type"
                               .to_string(),
                       )
                   })?;
   
               let binary_view = view_from_dict_values::<K, BinaryViewType, 
BinaryType>(
                   dict_array.values(),
                   dict_array.keys(),
               )?;
               Ok(Arc::new(binary_view))
           }
           _ => unpack_di
   ```
   
   When the dictionary is coverted to `BinaryView`, it can't be cast to 
`BinaryArray`



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to