MCPcopy Create free account
hub / github.com/apache/arrow / TestMoveWithArrayFactory

Method TestMoveWithArrayFactory

cpp/src/arrow/c/bridge_test.cc:734–760  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

732
733 template <typename ArrayFactory, typename ExportCheckFunc>
734 void TestMoveWithArrayFactory(ArrayFactory&& factory, ExportCheckFunc&& check_func) {
735 auto orig_bytes = pool_->bytes_allocated();
736
737 std::shared_ptr<Array> arr;
738 ASSERT_OK_AND_ASSIGN(arr, ToResult(factory()));
739 const ArrayData& data = *arr->data(); // non-owning reference
740 struct ArrowArray c_export_temp, c_export_final;
741 ASSERT_OK(ExportArray(*arr, &c_export_temp));
742
743 // Move the ArrowArray to its final location
744 ArrowArrayMove(&c_export_temp, &c_export_final);
745 ASSERT_TRUE(ArrowArrayIsReleased(&c_export_temp));
746
747 ArrayExportGuard guard(&c_export_final);
748 auto new_bytes = pool_->bytes_allocated();
749 ASSERT_GT(new_bytes, orig_bytes);
750 check_func(&c_export_final, data);
751
752 // Release the shared_ptr<Array>, underlying data should be held alive
753 arr.reset();
754 ASSERT_EQ(pool_->bytes_allocated(), new_bytes);
755 check_func(&c_export_final, data);
756
757 // Release the ArrowArray, underlying data should be destroyed
758 guard.Release();
759 ASSERT_EQ(pool_->bytes_allocated(), orig_bytes);
760 }
761
762 template <typename ArrayFactory>
763 void TestMoveNested(ArrayFactory&& factory) {

Callers

nothing calls this directly

Calls 10

ToResultFunction · 0.85
factoryFunction · 0.85
ArrowArrayMoveFunction · 0.85
ArrowArrayIsReleasedFunction · 0.85
ASSERT_OK_AND_ASSIGNFunction · 0.70
ExportArrayFunction · 0.70
bytes_allocatedMethod · 0.45
dataMethod · 0.45
resetMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected