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 c443576e08 Expose `fields` in `StructBuilder` (#8448)
c443576e08 is described below
commit c443576e08444f8215bfa29293539f9bd72d6276
Author: 张林伟 <[email protected]>
AuthorDate: Fri Sep 26 21:25:03 2025 +0800
Expose `fields` in `StructBuilder` (#8448)
# Which issue does this PR close?
# Rationale for this change
Field data type is useful when we try to downcast field builder.
# What changes are included in this PR?
Add `fields` getter method in `StructBuilder`.
# Are these changes tested?
CI.
# Are there any user-facing changes?
No.
---
arrow-array/src/builder/struct_builder.rs | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arrow-array/src/builder/struct_builder.rs
b/arrow-array/src/builder/struct_builder.rs
index 7f9400b52c..8c11454b98 100644
--- a/arrow-array/src/builder/struct_builder.rs
+++ b/arrow-array/src/builder/struct_builder.rs
@@ -201,6 +201,11 @@ impl StructBuilder {
self.field_builders.len()
}
+ /// Returns the fields for the struct this builder is building.
+ pub fn fields(&self) -> &Fields {
+ &self.fields
+ }
+
/// Appends an element (either null or non-null) to the struct. The actual
elements
/// should be appended for each child sub-array in a consistent way.
#[inline]