From b34badc84f753e4c0030bd9d31c966c75593f1b6 Mon Sep 17 00:00:00 2001 From: Andy Grove Date: Mon, 10 Jun 2024 14:39:38 -0600 Subject: [PATCH] simplify --- core/src/parquet/read/values.rs | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/core/src/parquet/read/values.rs b/core/src/parquet/read/values.rs index 6787131fc7..c2b1b6e64c 100644 --- a/core/src/parquet/read/values.rs +++ b/core/src/parquet/read/values.rs @@ -443,44 +443,21 @@ macro_rules! make_int_variant_impl { ($ty: ident, $native_ty: ty, $type_size: expr) => { impl PlainDecoding for $ty { fn decode(src: &mut PlainDecoderInner, dst: &mut ParquetMutableVector, num: usize) { - let num_bytes = 4 * num; // Parquet stores Int8/Int16 using 4 bytes - let src_data = &src.data; - let mut src_offset = src.offset; let dst_slice = dst.value_buffer.as_slice_mut(); let mut dst_offset = dst.num_values * $type_size; - - let mut i = 0; - while num - i >= 32 { - unsafe { - for _ in 0..32 { - copy_nonoverlapping( - &src_data[src_offset..] as *const [u8] as *const u8 - as *const $native_ty, - &mut dst_slice[dst_offset] as *mut u8 as *mut $native_ty, - 1, - ); - i += 1; - src_offset += 4; - dst_offset += $type_size; - } - } - } - - (0..(num - i)).for_each(|_| { + for _ in 0..num { unsafe { copy_nonoverlapping( - &src_data[src_offset..] as *const [u8] as *const u8 + &src_data[src.offset..] as *const [u8] as *const u8 as *const $native_ty, &mut dst_slice[dst_offset] as *mut u8 as *mut $native_ty, 1, ); } - src_offset += 4; + src.offset += 4; // Parquet stores Int8/Int16 using 4 bytes dst_offset += $type_size; - }); - - src.offset += num_bytes; + } } fn skip(src: &mut PlainDecoderInner, num: usize) {