You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2022/04/28 18:51:05 UTC

[arrow-rs] branch master updated: Clarify docs on UnionBuilder::append_null (#1628)

This is an automated email from the ASF dual-hosted git repository.

alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new 7da41c732 Clarify docs on UnionBuilder::append_null (#1628)
7da41c732 is described below

commit 7da41c7328820241a1e9a06eb83cade2e1f08da4
Author: Andrew Lamb <an...@nerdnetworks.org>
AuthorDate: Thu Apr 28 14:51:01 2022 -0400

    Clarify docs on UnionBuilder::append_null (#1628)
---
 arrow/src/array/builder.rs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arrow/src/array/builder.rs b/arrow/src/array/builder.rs
index 1c64b5062..cece334f6 100644
--- a/arrow/src/array/builder.rs
+++ b/arrow/src/array/builder.rs
@@ -2064,7 +2064,13 @@ impl UnionBuilder {
         }
     }
 
-    /// Appends a null to this builder.
+    /// Appends a null to this builder, encoding the null in the array
+    /// of the `type_name` child / field.
+    ///
+    /// Since `UnionArray` encodes nulls as an entry in its children
+    /// (it doesn't have a validity bitmap itself), and where the null
+    /// is part of the final array, appending a NULL requires
+    /// specifying which field (child) to use.
     #[inline]
     pub fn append_null<T: ArrowPrimitiveType>(&mut self, type_name: &str) -> Result<()> {
         self.append_option::<T>(type_name, None)