alamb commented on code in PR #11787:
URL: https://github.com/apache/datafusion/pull/11787#discussion_r1702261196


##########
datafusion/functions/src/string/starts_with.rs:
##########
@@ -53,16 +76,18 @@ impl Default for StartsWithFunc {
 impl StartsWithFunc {
     pub fn new() -> Self {
         use DataType::*;
+
+        let string_types = vec![Utf8, LargeUtf8, Utf8View];
+        let mut type_signatures = vec![];
+
+        for left in &string_types {

Review Comment:
   Yes I agree figuring out how to coerce the constant to Utf8view is important
   
   I think the coercion logic just goes linearly through the signature and 
stops at the first type that works.
   
   Thus I wonder if you can make `Utf8View` preferred by listing the types in a 
different order and put the `Utf8View` signature at the first option?  Like
   
   ```rust
               signature: Signature::one_of(
                   vec![
                       // make `Utf8View` first
                       Exact(vec![Utf8View, Utf8View]),
                       Exact(vec![Utf8, Utf8]),
                       Exact(vec![LargeUtf8, LargeUtf8]),
                   ],
                   Volatility::Immutable,
               ),
           }
   ```
   



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