jorgecarleitao / arrow2

Transmute-free Rust library to work with the Arrow format
Apache License 2.0
1.06k stars 222 forks source link

Implement `reserve_exact` on `Offsets` and mutable arrays #1371

Open kylebarron opened 1 year ago

kylebarron commented 1 year ago

👋 I'm working on an implementation of the geoarrow specification using arrow2. For conversions into the format, especially from https://github.com/georust/geozero, the exact length of the offset arrays (i.e. number of geometries, number of rings, etc) is advertised after initialization.

Would you take a PR to implement reserve_exact in addition to reserve? Or maybe this is a small micro-optimization that isn't worth implementing here?

jorgecarleitao commented 1 year ago

Awesome project!

Makes a lot of sense to have that - we follow as much as possible Rust's Vec API, so reserve_exact is a natural inclusion here (for offsets and other types als). Let me know if you would like to implement it or if I should.