tustvold commented on code in PR #3546:
URL: https://github.com/apache/arrow-rs/pull/3546#discussion_r1072484959
##########
arrow-select/src/concat.rs:
##########
@@ -30,24 +30,27 @@
//! assert_eq!(arr.len(), 3);
//! ```
+use arrow_array::types::*;
use arrow_array::*;
+use arrow_buffer::ArrowNativeType;
use arrow_data::transform::{Capacities, MutableArrayData};
-use arrow_data::ArrayData;
use arrow_schema::{ArrowError, DataType, SchemaRef};
-fn compute_str_values_length<Offset: OffsetSizeTrait>(arrays: &[&ArrayData])
-> usize {
- arrays
- .iter()
- .map(|&data| {
- // get the length of the value buffer
- let buf_len = data.buffers()[1].len();
- // find the offset of the buffer
- // this returns a slice of offsets, starting from the offset of
the array
- // so we can take the first value
- let offset = data.buffer::<Offset>(0)[0];
- buf_len - offset.to_usize().unwrap()
- })
- .sum()
+fn binary_capacity<T: ByteArrayType>(arrays: &[&dyn Array]) -> Capacities {
Review Comment:
I'm pretty chuffed with the GenericByteArray abstraction :smile:
--
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]