You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "alamb (via GitHub)" <gi...@apache.org> on 2024/09/25 19:40:25 UTC
Re: [PR] Improve performance of `trim` for string view (10%) [datafusion]
alamb commented on code in PR #12395:
URL: https://github.com/apache/datafusion/pull/12395#discussion_r1775902607
##########
datafusion/functions/src/string/common.rs:
##########
@@ -72,65 +94,126 @@ pub(crate) fn general_trim<T: OffsetSizeTrait>(
};
if use_string_view {
- string_view_trim::<T>(func, args)
+ string_view_trim(func, args)
} else {
string_trim::<T>(func, args)
}
}
// removing 'a will cause compiler complaining lifetime of `func`
-fn string_view_trim<'a, T: OffsetSizeTrait>(
- func: fn(&'a str, &'a str) -> &'a str,
+fn string_view_trim<'a>(
+ trim_func: fn(&'a str, &'a str) -> &'a str,
args: &'a [ArrayRef],
) -> Result<ArrayRef> {
- let string_array = as_string_view_array(&args[0])?;
+ let string_view_array = as_string_view_array(&args[0])?;
+ let mut views_buf = Vec::with_capacity(string_view_array.len());
+ let mut null_builder = NullBufferBuilder::new(string_view_array.len());
Review Comment:
I tried StringViewBuilder. It seems it doesn't permit pushing pre-created views.
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org