You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2024/08/13 20:05:52 UTC
(arrow-rs) branch master updated: Modest improvement to FixedLenByteArray BYTE_STREAM_SPLIT arrow decoder (#6222)
This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/master by this push:
new c1b3d98ce3 Modest improvement to FixedLenByteArray BYTE_STREAM_SPLIT arrow decoder (#6222)
c1b3d98ce3 is described below
commit c1b3d98ce3d94364856970e853041cb1b0a98b95
Author: Ed Seidl <et...@users.noreply.github.com>
AuthorDate: Tue Aug 13 13:05:48 2024 -0700
Modest improvement to FixedLenByteArray BYTE_STREAM_SPLIT arrow decoder (#6222)
* replace reserve/push with resize/direct access
* remove import
* make a bit faster
---
parquet/src/arrow/array_reader/fixed_len_byte_array.rs | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/parquet/src/arrow/array_reader/fixed_len_byte_array.rs b/parquet/src/arrow/array_reader/fixed_len_byte_array.rs
index 8098f3240a..670a97f351 100644
--- a/parquet/src/arrow/array_reader/fixed_len_byte_array.rs
+++ b/parquet/src/arrow/array_reader/fixed_len_byte_array.rs
@@ -410,7 +410,6 @@ impl ColumnValueDecoder for ValueDecoder {
// so `offset` should be the value offset, not the byte offset
let total_values = buf.len() / self.byte_length;
let to_read = num_values.min(total_values - *offset);
- out.buffer.reserve(to_read * self.byte_length);
// now read the n streams and reassemble values into the output buffer
read_byte_stream_split(&mut out.buffer, buf, *offset, to_read, self.byte_length);
@@ -453,9 +452,13 @@ fn read_byte_stream_split(
data_width: usize,
) {
let stride = src.len() / data_width;
- for i in 0..num_values {
- for j in 0..data_width {
- dst.push(src[offset + j * stride + i]);
+ let idx = dst.len();
+ dst.resize(idx + num_values * data_width, 0u8);
+ let dst_slc = &mut dst[idx..idx + num_values * data_width];
+ for j in 0..data_width {
+ let src_slc = &src[offset + j * stride..offset + j * stride + num_values];
+ for i in 0..num_values {
+ dst_slc[i * data_width + j] = src_slc[i];
}
}
}