Commits


Chao Sun authored and Andy Grove committed 0eadd412eb1
ARROW-3665: [Rust] Implement StructArrayBuilder This implements `StructArrayBuilder` which can be used to build struct arrays. There are some trickness in terms of being able to store child builders of different types. A natural way is to box them into `ArrayBuilder` trait and store in a vector. But, this makes it impossible to cast them into specific type in `field_builder()`. To solve the above issue, this maintains two references to each input builder instance, one in `Box<Any>` type and another in `Box<ArrayBuilder>` type. The former is used for casting mentioned above, while the latter is used for calling general methods on an builder, such as `len()` and `finish()`. To enable this, this also changed `ArrayBuilder::finish` to return a `ArrayRef` instead of a specific array. The old `finish` method is implemented on each specific array builder, so one can obtain, say, `Int32Array` from a `Int32ArrayBuilder`. Author: Chao Sun <sunchao@apache.org> Closes #3276 from sunchao/ARROW-3665 and squashes the following commits: 8fa3b61 <Chao Sun> Rename to_any to into_box_any 8aac785 <Chao Sun> Add append 227f3b2 <Chao Sun> Add from_schema 0e8e669 <Chao Sun> Fix rustfmt issues 5f59518 <Chao Sun> ARROW-3665: Implement StructArrayBuilder