progval commented on PR #9552:
URL: https://github.com/apache/arrow-rs/pull/9552#issuecomment-4073573208

   How? `DeltaBitPackEncoder` is not public so I can only test it through 
`ArrowWriter`, which is not unwind-safe.
   
   ```rust
   use arrow::array::StringArray;
   use arrow::datatypes::{DataType, Field, Schema};
   use arrow::record_batch::RecordBatch;
   use parquet::arrow::ArrowWriter;
   use parquet::basic::Encoding;
   use parquet::file::properties::WriterProperties;
   use std::sync::Arc;
   
   #[test]
   fn test_delta_bit_pack_type() {
       let props = WriterProperties::builder()
           .set_column_encoding("col".into(), Encoding::DELTA_BINARY_PACKED)
           .build();
   
       let record_batch = RecordBatch::try_new(
           Arc::new(Schema::new(vec![Field::new("col", DataType::Utf8, 
false)])),
           vec![Arc::new(StringArray::from_iter_values(vec!["a", "b"]))],
       )
       .unwrap();
   
       let res = std::panic::catch_unwind(|| {
           let mut buffer = Vec::new();
           let mut writer =
               ArrowWriter::try_new(&mut buffer, record_batch.schema(), 
Some(props)).unwrap();
           let _ = writer.write(&record_batch);
       });
       assert!(res.is_err());
   }
   ```
   
   ```
   error[E0277]: the type `(dyn arrow::array::Array + 'static)` may contain 
interior mutability and a reference may not be safely transferrable across a 
catch_unwind boundary
     --> parquet/tests/arrow_writer.rs:40:40
      |
   40 |       let res = std::panic::catch_unwind(|| {
      |  _______________------------------------_^
      | |               |
      | |               required by a bound introduced by this call
   41 | |         let mut buffer = Vec::new();
   42 | |         let mut writer =
   43 | |             ArrowWriter::try_new(&mut buffer, record_batch.schema(), 
Some(props)).unwrap();
   44 | |         let _ = writer.write(&record_batch);
   45 | |     });
      | |_____^ `(dyn arrow::array::Array + 'static)` may contain interior 
mutability and a reference may not be safely transferrable across a 
catch_unwind boundary
   ```


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