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

Method ToTensorWithNulls

cpp/src/arrow/array/array_primitive.h:145–157  ·  view source on GitHub ↗

\brief Return a one dimensional Tensor.

Source from the content-addressed store, hash-verified

143
144 /// \brief Return a one dimensional Tensor.
145 Result<std::shared_ptr<Tensor>> ToTensorWithNulls() const override {
146 // Could be non-templated
147 const int64_t byte_width = type()->byte_width();
148 std::shared_ptr<Buffer> buffer;
149 if (data_->buffers[1] != NULLPTR) {
150 // Array guarantees this will not overflow.
151 const int64_t byte_offset = data_->offset * byte_width;
152 const int64_t byte_length = length() * byte_width;
153 ARROW_ASSIGN_OR_RAISE(buffer,
154 SliceBufferSafe(data_->buffers[1], byte_offset, byte_length));
155 }
156 return Tensor::Make(type(), std::move(buffer), {length()});
157 }
158
159 const value_type* values_;
160};

Callers

nothing calls this directly

Calls 6

SliceBufferSafeFunction · 0.85
typeFunction · 0.70
lengthFunction · 0.70
MakeFunction · 0.70
ARROW_ASSIGN_OR_RAISEFunction · 0.50
byte_widthMethod · 0.45

Tested by

no test coverage detected