WillAyd commented on code in PR #710:
URL: https://github.com/apache/arrow-nanoarrow/pull/710#discussion_r1970533585


##########
src/nanoarrow/common/inline_array.h:
##########
@@ -310,7 +313,23 @@ static inline ArrowErrorCode 
_ArrowArrayAppendEmptyInternal(struct ArrowArray* a
           NANOARROW_RETURN_NOT_OK(_ArrowArrayAppendBits(array, i, 0, n));
         }
         continue;
+      case NANOARROW_BUFFER_TYPE_VIEW_OFFSET: {
+        NANOARROW_RETURN_NOT_OK(ArrowBufferReserve(buffer, size_bytes * n));
+
+        if (array->length == 0) {
+          const int64_t zero_val = 0;
+          for (int64_t j = 0; j < n; j++) {
+            ArrowBufferAppendUnsafe(buffer, &zero_val, size_bytes);
+          }
+        } else {
+          for (int64_t j = 0; j < n; j++) {
+            ArrowBufferAppendUnsafe(
+                buffer, buffer->data + size_bytes * (array->length + j - 1), 
size_bytes);
+          }

Review Comment:
   Yes it can be. The only advantage I think to doing it this way is it aligns 
better with how the current LIST types work, possibly making the tests easier 
to parametrize. 
   
   We can cross that bridge when we get there though; for now setting to 0 
should work fine



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to