rustyconover commented on code in PR #930:
URL: https://github.com/apache/arrow-nanoarrow/pull/930#discussion_r3924879874


##########
src/nanoarrow/common/array.c:
##########
@@ -77,6 +77,174 @@ int ArrowArrayIsInternal(struct ArrowArray* array) {
   return array->release == &ArrowArrayReleaseInternal;
 }
 
+static ArrowErrorCode ArrowArrayAppendArrayViewElement(struct ArrowArray* dst,
+                                                       const struct 
ArrowArrayView* src,
+                                                       int64_t i,
+                                                       struct ArrowError* 
error) {

Review Comment:
   Addressed in 4974cd7. Matching byte-aligned primitive storage takes a bulk 
buffer-copy path. Validity is copied in bounded uint8 chunks so sliced bitmaps 
and all four source/destination bitmap-presence combinations are handled.



##########
src/nanoarrow/common/array_test.cc:
##########
@@ -5087,3 +5087,232 @@ TEST(ArrayMoveSharedTest, ArrayWithNullBuffers) {
 
   ArrowArrayRelease(&shared);
 }
+
+static ArrowErrorCode AppendArrayViewForTest(const struct ArrowArrayView* src,
+                                             struct ArrowArray* dst,
+                                             struct ArrowError* error) {

Review Comment:
   Addressed in e56f47b. Added Arrow C++-gated source/destination matrices for 
signed integers, unsigned integers, string/large_string, binary/large_binary, 
and list/large_list, with Arrow C++ equality checks on the imported result.



##########
src/nanoarrow/common/array_test.cc:
##########
@@ -5087,3 +5087,232 @@ TEST(ArrayMoveSharedTest, ArrayWithNullBuffers) {
 
   ArrowArrayRelease(&shared);
 }
+
+static ArrowErrorCode AppendArrayViewForTest(const struct ArrowArrayView* src,
+                                             struct ArrowArray* dst,
+                                             struct ArrowError* error) {
+  NANOARROW_RETURN_NOT_OK(ArrowArrayInitFromArrayView(dst, src, error));
+  NANOARROW_RETURN_NOT_OK(ArrowArrayStartAppending(dst));
+  NANOARROW_RETURN_NOT_OK(ArrowArrayAppendArrayView(dst, src, error));
+  return ArrowArrayFinishBuildingDefault(dst, error);
+}
+
+static void ExpectPrimitiveArrayViewAppendIdentical(struct ArrowArray* src,
+                                                    enum ArrowType type) {
+  struct ArrowError error;
+  struct ArrowArrayView src_view;
+  ArrowArrayViewInitFromType(&src_view, type);
+  ASSERT_EQ(ArrowArrayViewSetArray(&src_view, src, &error), NANOARROW_OK)
+      << error.message;
+
+  struct ArrowArray dst;
+  ASSERT_EQ(AppendArrayViewForTest(&src_view, &dst, &error), NANOARROW_OK)
+      << error.message;
+  struct ArrowArrayView dst_view;
+  ArrowArrayViewInitFromType(&dst_view, type);
+  ASSERT_EQ(ArrowArrayViewSetArray(&dst_view, &dst, &error), NANOARROW_OK)
+      << error.message;
+
+  int identical = 0;
+  ASSERT_EQ(ArrowArrayViewCompare(&src_view, &dst_view, 
NANOARROW_COMPARE_IDENTICAL,
+                                  &identical, &error),
+            NANOARROW_OK);
+  EXPECT_EQ(identical, 1) << error.message;
+
+  ArrowArrayViewReset(&dst_view);
+  ArrowArrayRelease(&dst);
+  ArrowArrayViewReset(&src_view);
+}
+
+TEST(ArrayTest, ArrayAppendArrayViewPrimitiveTypes) {
+  struct ArrowArray array;
+
+  ASSERT_EQ(ArrowArrayInitFromType(&array, NANOARROW_TYPE_INT64), 
NANOARROW_OK);

Review Comment:
   Addressed in e56f47b. Added tests for integer narrowing overflow, int32 
list-offset overflow using a Null child, successful dictionary storage copying 
with caller-managed dictionary values, and rejection when only one side is 
dictionary-encoded.



-- 
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