lidavidm commented on code in PR #82:
URL: https://github.com/apache/arrow-nanoarrow/pull/82#discussion_r1041484656


##########
src/nanoarrow/array_inline.h:
##########
@@ -107,29 +107,69 @@ static inline ArrowErrorCode _ArrowArrayAppendBits(struct 
ArrowArray* array,
   return NANOARROW_OK;
 }
 
-static inline ArrowErrorCode ArrowArrayAppendNull(struct ArrowArray* array, 
int64_t n) {
+static inline ArrowErrorCode _ArrowArrayAppendEmptyInternal(struct ArrowArray* 
array,
+                                                            int64_t n, uint8_t 
is_valid) {
   struct ArrowArrayPrivateData* private_data =
       (struct ArrowArrayPrivateData*)array->private_data;
 
   if (n == 0) {
     return NANOARROW_OK;
   }
 
-  if (private_data->storage_type == NANOARROW_TYPE_NA) {
-    array->null_count += n;
-    array->length += n;
-    return NANOARROW_OK;
+  // Some type-specific handling
+  switch (private_data->storage_type) {
+    case NANOARROW_TYPE_NA:
+      array->null_count += n * !is_valid;
+      array->length += n;
+      return NANOARROW_OK;
+    case NANOARROW_TYPE_DENSE_UNION:
+      // Add one null to the first child and append n references to that child
+      // (Currently assumes type_id == child_index)

Review Comment:
   Maybe the appender's signature should require the caller to maintain this 
mapping (and if not given, assume type ID == child index for simplicity?)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to