crepererum opened a new issue, #3496:
URL: https://github.com/apache/arrow-rs/issues/3496

   **Describe the bug**
   It seems that the IPC writer doesn't correctly account for sliced boolean 
columns.
   
   **To Reproduce**
   ```rust
   #[test]
   fn encode_bools() {
       let val_bool_field = Field::new("val", DataType::Boolean, false);
   
       let schema = Arc::new(Schema::new(vec![val_bool_field]));
   
       let bools = BooleanArray::from(vec![true, false]);
   
       let batch =
           RecordBatch::try_new(Arc::clone(&schema), 
vec![Arc::new(bools)]).unwrap();
       let batch = batch.slice(1, 1);
   
       let mut writer = StreamWriter::try_new(Vec::<u8>::new(), 
&schema).unwrap();
       writer.write(&batch).unwrap();
       writer.finish().unwrap();
       let data = writer.into_inner().unwrap();
   
       let mut reader = StreamReader::try_new(Cursor::new(data), None).unwrap();
       let batch2 = reader.next().unwrap().unwrap();
       assert_eq!(batch, batch2);
   }
   ```
   
   This fails with:
   
   ```text
   thread 'writer::tests::encode_bools' panicked at 'assertion failed: `(left 
== right)`
     left: `RecordBatch { schema: Schema { fields: [Field { name: "val", 
data_type: Boolean, nullable: false, dict_id: 0, dict_is_ordered: false, 
metadata: {} }], metadata: {} }, columns: [BooleanArray
   [
     false,
   ]], row_count: 1 }`,
    right: `RecordBatch { schema: Schema { fields: [Field { name: "val", 
data_type: Boolean, nullable: false, dict_id: 0, dict_is_ordered: false, 
metadata: {} }], metadata: {} }, columns: [BooleanArray
   [
     true,
   ]], row_count: 1 }`', arrow-ipc/src/writer.rs:1953:9
   ```
   
   **Expected behavior**
   Test passes.
   
   **Additional context**
   Tested on commit 
https://github.com/apache/arrow-rs/commit/eae993fd196d0a8df8a90857bc4a7ae8f5a3e845
 .
   
   Originally observed in 
https://github.com/influxdata/influxdb_iox/issues/6515 . There we've also 
looked into the raw IPC data which lead to the conclusion that this is likely 
related to boolean columns (since other columns seem to work) and a writer 
issue (not a reader issue).


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