Omega359 commented on code in PR #19402:
URL: https://github.com/apache/datafusion/pull/19402#discussion_r2651462933


##########
datafusion/functions/src/string/to_hex.rs:
##########
@@ -131,25 +118,37 @@ impl ScalarUDFImpl for ToHexFunc {
         &self.signature
     }
 
-    fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> {
-        Ok(match arg_types[0] {
-            Int8 | Int16 | Int32 | Int64 | UInt8 | UInt16 | UInt32 | UInt64 => 
Utf8,
-            _ => {
-                return plan_err!("The to_hex function can only accept 
integers.");
-            }
-        })
+    fn return_type(&self, _arg_types: &[DataType]) -> Result<DataType> {
+        Ok(DataType::Utf8)
     }
 
     fn invoke_with_args(&self, args: ScalarFunctionArgs) -> 
Result<ColumnarValue> {
         match args.args[0].data_type() {
-            Int64 => make_scalar_function(to_hex::<Int64Type>, 
vec![])(&args.args),
-            UInt64 => make_scalar_function(to_hex::<UInt64Type>, 
vec![])(&args.args),
-            Int32 => make_scalar_function(to_hex::<Int32Type>, 
vec![])(&args.args),
-            UInt32 => make_scalar_function(to_hex::<UInt32Type>, 
vec![])(&args.args),
-            Int16 => make_scalar_function(to_hex::<Int16Type>, 
vec![])(&args.args),
-            UInt16 => make_scalar_function(to_hex::<UInt16Type>, 
vec![])(&args.args),
-            Int8 => make_scalar_function(to_hex::<Int8Type>, 
vec![])(&args.args),
-            UInt8 => make_scalar_function(to_hex::<UInt8Type>, 
vec![])(&args.args),
+            DataType::Null => 
Ok(ColumnarValue::Scalar(ScalarValue::Utf8(None))),

Review Comment:
   I'm sure some future refactor will change this :)



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