alamb commented on a change in pull request #820:
URL: https://github.com/apache/arrow-rs/pull/820#discussion_r724365907
##########
File path: parquet/src/arrow/arrow_writer.rs
##########
@@ -461,15 +461,25 @@ fn write_leaf(
macro_rules! def_get_binary_array_fn {
($name:ident, $ty:ty) => {
fn $name(array: &$ty) -> Vec<ByteArray> {
- let mut values = Vec::with_capacity(array.len() -
array.null_count());
- for i in 0..array.len() {
- if array.is_valid(i) {
- let bytes: Vec<u8> = array.value(i).into();
- let bytes = ByteArray::from(bytes);
- values.push(bytes);
- }
- }
- values
+ let mut byte_array = ByteArray::new();
Review comment:
I reviewed the logic carefully (creating a new ByteArray and then
slicing that rather than making multiple new ByteArrays) and it makes sense to
me
It is unfortunate we need to copy the data at all (as the arrow `Buffer` is
the same basic ref counted view into the array as `ByteAray` is) but I realize
that is because the parquet and arrow implementations use different underlying
structures
--
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]