chmp / serde_arrow

Convert sequences of Rust objects to Arrow tables
MIT License
60 stars 17 forks source link

ArrayBuilder is not Send #225

Open gz opened 2 weeks ago

gz commented 2 weeks ago

I'm getting

190 |             let mut insert_builder = Arc::new(ArrayBuilder::new(sas).expect("can build array"));
    |                 ------------------ has type `Arc<serde_arrow::ArrayBuilder>` which is not `Send`

if I try to use ArrayBuilder in async functions (which often have the Send constraint for the things in the closure). I think the problem is the raw pointer here:

https://github.com/chmp/serde_arrow/blob/eb8d37a5bdab748251aa983cb1c1517047f28702/serde_arrow/src/internal/serialization/struct_builder.rs#L23C1-L23C55

Maybe it could be rewritten to not use raw pointers. Or be declared as Send if the raw pointer isn't used in a way that breaks Send guarantees (from a quick glance I don't think it is).

chmp commented 2 weeks ago

@gz Thanks for the report. You're right there is no reason for the structure to not be Send. I will fix this issue on the develop-0.12 branch.

chmp commented 1 week ago

Fixed with #227. I will close this issue once I release 0.12. The refactoring of the error messages will take some time though

gz commented 1 week ago

Awesome thanks for the quick turnaround!