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


##########
datafusion/functions/src/unicode/reverse.rs:
##########
@@ -107,20 +113,38 @@ impl ScalarUDFImpl for ReverseFunc {
 /// Reverses the order of the characters in the string `reverse('abcde') = 
'edcba'`.
 /// The implementation uses UTF-8 code points as characters
 fn reverse<T: OffsetSizeTrait>(args: &[ArrayRef]) -> Result<ArrayRef> {

Review Comment:
   We probably should take this opportunity to refactor the `T` generic out of 
`reverse` here, since it reads a bit confusing to match on datatype in 
`invoke_with_args` to determine the `T` for `reverse` but then we again match 
inside `reverse` anyway.



##########
datafusion/functions/src/unicode/reverse.rs:
##########
@@ -82,7 +84,11 @@ impl ScalarUDFImpl for ReverseFunc {
     }
 
     fn return_type(&self, arg_types: &[DataType]) -> Result<DataType> {
-        utf8_to_str_type(&arg_types[0], "reverse")
+        if arg_types[0] == Utf8View {

Review Comment:
   Alternatively just
   
   ```rust
   Ok(arg_types[0].clone())
   ```



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