tshauck commented on code in PR #11787: URL: https://github.com/apache/datafusion/pull/11787#discussion_r1702211675
########## 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: Thanks for this and link to the tests -- very helpful! I made this update along with simplifying the arrow starts_with call (https://github.com/apache/datafusion/pull/11787#discussion_r1702177110), and I'm noticing that `STARTS_WITH(column1_utf8view, 'foo')` results in a cast of the first column to utf8 while keeping the second one utf8, but I think we'd want to keep the first argument as a utf8view while coercing the second argument to utf8view? It feels like calling `starts_with` with a second argument as a scalar is common. For example, with the changes, this test passes: ``` query TT EXPLAIN SELECT STARTS_WITH(column1_utf8view, 'foo') as c, STARTS_WITH(column1_utf8view, column2_utf8view) as c2 FROM test; ---- logical_plan 01)Projection: starts_with(CAST(test.column1_utf8view AS Utf8), Utf8("foo")) AS c, starts_with(test.column1_utf8view, test.column2_utf8view) AS c2 02)--TableScan: test projection=[column1_utf8view, column2_utf8view] ``` -- 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