Kev1n8 commented on issue #11835:
URL: https://github.com/apache/datafusion/issues/11835#issuecomment-2275016296

   I have a question about how this should be done. BTRIM would like to modify 
the input string, while `Utf8View` is not mutable. So is it correct that the 
input `data_type` can only be `Utf8` or `LargeUtf8`? If so, should I leave the 
signature as 
   ```
               signature: Signature::one_of(
                   vec![
                       Exact(vec![Utf8]),
                       Exact(vec![Utf8, Utf8]),
                       Exact(vec![Utf8, Utf8View]),
                       // BTRIM wants to modify string, while StringView is not 
mutable, hence
                       // input should be cast to utf8
                       // Exact(vec![Utf8View]),
                       // Exact(vec![Utf8View, Utf8]),
                       // Exact(vec![Utf8View, Utf8View]),
                   ],
                   Volatility::Immutable,
               ),
   ```
   or manually cast it in `invoke()`, which does not display `CAST` in plans:
   ```
   
               DataType::Utf8View => {
                   let args = &[
                       args[0].cast_to(&DataType::Utf8, None)?,
                       args[1].clone(),
                   ];
                   make_scalar_function(
                       btrim::<i32>,
                       vec![Hint::Pad, Hint::AcceptsSingular],
                   )(args)
               }
   ```


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