paleolimbot commented on code in PR #39455:
URL: https://github.com/apache/arrow/pull/39455#discussion_r1469595392


##########
cpp/src/arrow/c/bridge_test.cc:
##########
@@ -4506,6 +4554,29 @@ class TestArrayStreamRoundtrip : public 
BaseArrayStreamTest {
     ASSERT_TRUE(weak_reader.expired());
   }
 
+  void Roundtrip(std::shared_ptr<ChunkedArray> src,
+                 std::function<void(const std::shared_ptr<ChunkedArray>&)> 
check_func) {
+    ArrowArrayStream c_stream;
+
+    // One original copy which to compare the result, one copy held by the 
stream
+    std::weak_ptr<ChunkedArray> weak_src(src);
+    ASSERT_EQ(weak_src.use_count(), 2);
+
+    ASSERT_OK(ExportChunkedArray(std::move(src), &c_stream));
+    ASSERT_FALSE(ArrowArrayStreamIsReleased(&c_stream));
+
+    {
+      ASSERT_OK_AND_ASSIGN(auto dst, ImportChunkedArray(&c_stream));
+      // Stream was moved, consumed, and released
+      ASSERT_TRUE(ArrowArrayStreamIsReleased(&c_stream));
+
+      // Stream was released by ImportChunkedArray but original copy remains
+      ASSERT_EQ(weak_src.use_count(), 1);

Review Comment:
   I copied it from the previous test...I'm happy to remove it!



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