kazuyukitanimura commented on code in PR #604:
URL: https://github.com/apache/datafusion-comet/pull/604#discussion_r1681599377


##########
native/core/src/parquet/read/values.rs:
##########
@@ -439,14 +466,61 @@ macro_rules! make_int_variant_impl {
 
 make_int_variant_impl!(Int8Type, copy_i32_to_i8, 1);
 make_int_variant_impl!(Int16Type, copy_i32_to_i16, 2);
-make_int_variant_impl!(Int32To64Type, copy_i32_to_i64, 4);
+make_int_variant_impl!(Int16ToDoubleType, copy_i32_to_f64, 8); // Parquet uses 
Int16 using 4 bytes
+make_int_variant_impl!(Int32To64Type, copy_i32_to_i64, 8);
+make_int_variant_impl!(Int32ToDoubleType, copy_i32_to_f64, 8);
+make_int_variant_impl!(FloatToDoubleType, copy_f32_to_f64, 8);
 
 // unsigned type require double the width and zeroes are written for the 
second half
 // perhaps because they are implemented as the next size up signed type?
 make_int_variant_impl!(UInt8Type, copy_i32_to_u8, 2);
 make_int_variant_impl!(UInt16Type, copy_i32_to_u16, 4);
 make_int_variant_impl!(UInt32Type, copy_i32_to_u32, 8);
 
+macro_rules! make_int_decimal_variant_impl {
+    ($ty:ty, $copy_fn:ident, $type_width:expr, $dst_type:ty) => {
+        impl PlainDecoding for $ty {
+            fn decode(src: &mut PlainDecoderInner, dst: &mut 
ParquetMutableVector, num: usize) {
+                let dst_slice = dst.value_buffer.as_slice_mut();
+                let dst_offset = dst.num_values * 8;
+                $copy_fn(&src.data[src.offset..], &mut 
dst_slice[dst_offset..], num);
+
+                let src_scale = ::std::cmp::max(src.desc.type_scale(), 0) as 
u32;
+                let dst_scale = match dst.arrow_type {
+                    ArrowDataType::Decimal128(_precision, scale) if scale >= 0 
=> scale as u32,
+                    _ => unreachable!(),
+                };
+                let v = dst_slice[dst_offset..].as_mut_ptr() as *mut $dst_type;
+                if dst_scale > src_scale {
+                    let mul = (10 as $dst_type).pow(dst_scale - src_scale);
+                    for i in 0..num {
+                        unsafe {

Review Comment:
   updated



##########
native/core/src/parquet/read/values.rs:
##########
@@ -285,6 +259,59 @@ impl PlainDecoding for Int32DateType {
     }
 }
 
+impl PlainDecoding for Int32TimestampMicrosType {
+    #[inline]
+    fn decode(src: &mut PlainDecoderInner, dst: &mut ParquetMutableVector, 
num: usize) {
+        let src_data = &src.data;
+        let byte_width = src.desc.type_length() as usize;
+        let num_bytes = byte_width * num;
+
+        {
+            let mut offset = src.offset;
+            for _ in 0..num {
+                let v = &src_data[offset..offset + byte_width] as *const [u8] 
as *const u8

Review Comment:
   updated



-- 
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]

Reply via email to