lyne7-sc commented on code in PR #19547:
URL: https://github.com/apache/datafusion/pull/19547#discussion_r2658668388
##########
datafusion/functions/src/string/concat.rs:
##########
@@ -206,7 +207,11 @@ impl ScalarUDFImpl for ConcatFunc {
DataType::Utf8View => {
let string_array = as_string_view_array(array)?;
- data_size += string_array.len();
+ data_size += string_array
+ .data_buffers()
+ .iter()
+ .map(|buf| buf.len())
+ .sum::<usize>();
Review Comment:
> I'm a bit cautious that this could significantly overestimate the size
required, depending on the string view passed in 🤔
Agreed, thanks for pointing this out.
I checked the `StringViewArray` doc, and I think we can use `ByteView` to
derive the logical length of each data slice more accurately.
```Rust
data_size += string_array
.views()
.iter()
.map(|&v| {
ByteView::from(v).length as usize
})
.sum::<usize>();
```
If this looks reasonable to you, please let me know and I’ll proceed with
this approach.
--
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]