Jefffrey commented on PR #10798:
URL: https://github.com/apache/arrow-rs/pull/10798#issuecomment-5466592651

   i tried again; copying only the `test_decimal128_under_aligned_round_trip` 
test into main without any of these fixes, and running with ffi + 
force_validate (and without), the test succeeds on main:
   
   ```sh
   arrow-rs (main)$ cargo test -p arrow-array --features ffi --lib under_aligned
       Finished `test` profile [unoptimized + debuginfo] target(s) in 0.06s
        Running unittests src/lib.rs 
(/Users/jeffrey/.cargo_target_cache/debug/deps/arrow_array-6904f486d1ee4d68)
   
   running 1 test
   test ffi::tests_to_then_from_ffi::test_decimal128_under_aligned_round_trip 
... ok
   
   test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 770 filtered 
out; finished in 0.00s
   
   arrow-rs (main)$ cargo test -p arrow-array --features force_validate,ffi 
--lib under_aligned
       Finished `test` profile [unoptimized + debuginfo] target(s) in 0.07s
        Running unittests src/lib.rs 
(/Users/jeffrey/.cargo_target_cache/debug/deps/arrow_array-a9af9d70cecd6150)
   
   running 1 test
   test ffi::tests_to_then_from_ffi::test_decimal128_under_aligned_round_trip 
... ok
   
   test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 756 filtered 
out; finished in 0.01s
   ```
   
   could you double check if this test is exercising a failure behaviour we're 
supposed to see on main? or am i doing something wrong
   
   for reference, this is the copy pasted test as of the state of this PR:
   
   ```rust
   // arrow-array/src/ffi.rs
   
   #[test]
   fn test_decimal128_under_aligned_round_trip() -> Result<()> {
       // 8-byte-aligned i128 buffer: legal over the C Data Interface, but
       // under-aligned for arrow-rs. Carried as `FixedSizeBinary(16)` (1-byte
       // alignment) so the fixture stays valid under `force_validate`, then
       // imported as `Decimal128`, which must realign it.
       let aligned = Buffer::from_vec(vec![0_i128, 1_i128, 2_i128]);
       let under_aligned = aligned.slice(8);
       assert_eq!(under_aligned.as_ptr().align_offset(8), 0);
       assert_ne!(under_aligned.as_ptr().align_offset(16), 0);
   
       let data = ArrayData::builder(DataType::FixedSizeBinary(16))
           .len(2)
           .add_buffer(under_aligned)
           .build()?;
   
       let array = FFI_ArrowArray::new(&data);
       let imported = unsafe { from_ffi_and_data_type(array, 
DataType::Decimal128(10, 2)) }?;
       let array = Decimal128Array::from(imported);
   
       // [0i128, 1, 2] sliced 8 bytes in yields `1 << 64` and `2 << 64`.
       assert_eq!(array.len(), 2);
       assert_eq!(array.value(0), 1_i128 << 64);
       assert_eq!(array.value(1), 2_i128 << 64);
       Ok(())
   }
   ```


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

Reply via email to