Kev1n8 commented on code in PR #12044:
URL: https://github.com/apache/datafusion/pull/12044#discussion_r1722708925
##########
datafusion/functions/src/utils.rs:
##########
@@ -71,6 +71,20 @@ macro_rules! get_optimal_return_type {
// `utf8_to_str_type`: returns either a Utf8 or LargeUtf8 based on the input
type size.
get_optimal_return_type!(utf8_to_str_type, DataType::LargeUtf8,
DataType::Utf8);
+// `optimized_utf8_to_str_type`: returns Utf8View when the string function has
a specialised
+// implementation for StringView which returns Utf8View.
+pub(crate) fn optimized_utf8_to_str_type(
+ arg_type: &DataType,
+ name: &str,
+) -> Result<DataType> {
+ let support_list = ["substr"];
+ if support_list.contains(&name) {
+ Ok(DataType::Utf8View)
+ } else {
+ utf8_to_str_type(arg_type, name)
+ }
+}
Review Comment:
yeah, I think so too.
--
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]