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

   **Describe the bug**
   Encoding succeeds, but decoding fails with an error 
`InvalidArgumentError("all columns in a record batch must have the specified 
row count")`.
   
   **To Reproduce**
   
   ```rust
   // add to arrow-ipc/src/writer.rs
   #[test]
   fn ipc_struct_array_with_zero_fields() {
       let record_batch = {
           let struct_ty = DataType::Struct(Vec::<Field>::new().into());
           let structs = ArrayDataBuilder::new(struct_ty.clone())
               .len(3)
               .build()
               .unwrap();
           RecordBatch::try_new_with_options(
               Arc::new(Schema::new(vec![Field::new("field", struct_ty, 
false)])),
               vec![make_array(structs)],
               &RecordBatchOptions::new().with_row_count(Some(3)),
           )
           .unwrap()
       };
       let deserialized_batch = deserialize(serialize(&record_batch));
   
       let structs = deserialized_batch
           .column(0)
           .as_any()
           .downcast_ref::<StructArray>()
           .unwrap();
   
       assert_eq!(structs.len(), 3);
   }
   ```
   
   ```
   thread 'writer::tests::ipc_struct_array_with_zero_fields' panicked at 
'called `Result::unwrap()` on an `Err` value: InvalidArgumentError("all columns 
in a record batch must have the specified row count")', 
arrow-ipc\src\writer.rs:1816:39
   stack backtrace:
      0: rust_begin_unwind
                at 
/rustc/864bdf7843e1ceabc824ed86d97006acad6af643/library\std\src/panicking.rs:617:5
      1: core::panicking::panic_fmt
                at 
/rustc/864bdf7843e1ceabc824ed86d97006acad6af643/library\core\src/panicking.rs:67:14
      2: core::result::unwrap_failed
                at 
/rustc/864bdf7843e1ceabc824ed86d97006acad6af643/library\core\src/result.rs:1651:5
      3: core::result::Result<T,E>::unwrap
                at 
/rustc/864bdf7843e1ceabc824ed86d97006acad6af643\library\core\src/result.rs:1076:23
      4: arrow_ipc::writer::tests::deserialize
                at .\src\writer.rs:1816:9
      5: arrow_ipc::writer::tests::ipc_struct_array_with_zero_fields
                at .\src\writer.rs:1976:34
      6: 
arrow_ipc::writer::tests::ipc_struct_array_with_zero_fields::{{closure}}
                at .\src\writer.rs:1962:44
      7: core::ops::function::FnOnce::call_once
                at 
/rustc/864bdf7843e1ceabc824ed86d97006acad6af643\library\core\src\ops/function.rs:250:5
      8: core::ops::function::FnOnce::call_once
                at 
/rustc/864bdf7843e1ceabc824ed86d97006acad6af643/library\core\src\ops/function.rs:250:5
   ```
   
   **Expected behavior**
   Successful roundtrip conversion
   
   **Additional context**
   <!--
   Add any other context about the problem here.
   -->


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