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

Method ImportBuffer

cpp/src/arrow/c/bridge.cc:1920–1943  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1918 }
1919
1920 Status ImportBuffer(int32_t buffer_id, int64_t buffer_size,
1921 bool is_null_bitmap = false) {
1922 std::shared_ptr<Buffer>* out = &data_->buffers[buffer_id];
1923 auto data = reinterpret_cast<const uint8_t*>(c_struct_->buffers[buffer_id]);
1924 if (data != nullptr) {
1925 if (memory_mgr_) {
1926 *out = std::make_shared<ImportedBuffer>(data, buffer_size, memory_mgr_,
1927 device_type_, import_);
1928 } else {
1929 *out = std::make_shared<ImportedBuffer>(data, buffer_size, import_);
1930 }
1931 } else if (is_null_bitmap) {
1932 out->reset();
1933 } else {
1934 // Ensure that imported buffers are never null (except for the null bitmap)
1935 if (buffer_size != 0) {
1936 return Status::Invalid(
1937 "ArrowArrayStruct contains null data pointer "
1938 "for a buffer with non-zero computed size");
1939 }
1940 *out = zero_size_buffer_;
1941 }
1942 return Status::OK();
1943 }
1944
1945 struct ArrowArray* c_struct_;
1946 int64_t recursion_level_;

Callers

nothing calls this directly

Calls 3

InvalidFunction · 0.50
OKFunction · 0.50
resetMethod · 0.45

Tested by

no test coverage detected