Commits


Jorge C. Leitao authored and Neville Dipale committed c3e399c5fe1
ARROW-10065: [Rust] Simplify code (+500, -1k) This is a major internal simplification of Rust's code base, with no change of functionality apart of the no longer needed `StringArrayOps` that this PR removes. The main idea behind this PR is that when we have array types that implement `i32` and `i64` (large), we can declare them as a generic struct of the form ```rust pub struct GenericXArray<OffsetSize> ``` as they have a uniform representation under the trait. Specifically: * `[Large]BinaryArray`'s represents `[u8]` * `[Large]ListArray`'s represents `[ArrayRef]` * `[Large]StringArray`'s represents `[&str]` This PR does this for ```rust pub struct GenericBinaryArray<OffsetSize> pub struct GenericStringArray<OffsetSize> pub struct GenericListArray<OffsetSize> ``` where `OffsetSize` is either `i64` or `i32`. The actual arrays are then implemented as ```rust pub type BinaryArray = GenericBinaryArray<i32>; pub type LargeBinaryArray = GenericBinaryArray<i64>; pub type ListArray = GenericListArray<i32>; pub type LargeListArray = GenericListArray<i64>; pub type StringArray = GenericStringArray<i32>; pub type LargeStringArray = GenericStringArray<i64>; ``` This leads to a massive removal of code. Since all of this is statically typed, the actual work is done by the compiler and we just have less code to maintain. There is more code that continues to be duplicated on `equal.rs`, but I decided to leave that to a separate PR. FYI @nevi-me @paddyhoran @andygrove Closes #8242 from jorgecarleitao/clean Authored-by: Jorge C. Leitao <jorgecarleitao@gmail.com> Signed-off-by: Neville Dipale <nevilledips@gmail.com>