This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
The following commit(s) were added to refs/heads/main by this push:
new e1ac27767c Expose `field_builders` in `StructBuilder` (#7217)
e1ac27767c is described below
commit e1ac27767ca2139f682a1b0cc08a221010bb4daf
Author: 张林伟 <[email protected]>
AuthorDate: Tue Mar 11 18:23:20 2025 +0800
Expose `field_builders` in `StructBuilder` (#7217)
* Expose field_builders in StructBuilder
* Add field_builders_mut
---
arrow-array/src/builder/struct_builder.rs | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arrow-array/src/builder/struct_builder.rs
b/arrow-array/src/builder/struct_builder.rs
index 5cebc6485e..4379a7d0cf 100644
--- a/arrow-array/src/builder/struct_builder.rs
+++ b/arrow-array/src/builder/struct_builder.rs
@@ -372,6 +372,16 @@ impl StructBuilder {
self.field_builders[i].as_any_mut().downcast_mut::<T>()
}
+ /// Returns a reference to field builders
+ pub fn field_builders(&self) -> &[Box<dyn ArrayBuilder>] {
+ &self.field_builders
+ }
+
+ /// Returns a mutable reference to field builders
+ pub fn field_builders_mut(&mut self) -> &mut [Box<dyn ArrayBuilder>] {
+ &mut self.field_builders
+ }
+
/// Returns the number of fields for the struct this builder is building.
pub fn num_fields(&self) -> usize {
self.field_builders.len()