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

Function CopyToImpl

cpp/src/arrow/array/data.cc:152–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150namespace {
151template <typename Fn>
152Result<std::shared_ptr<ArrayData>> CopyToImpl(const ArrayData& data,
153 const std::shared_ptr<MemoryManager>& to,
154 Fn&& copy_fn) {
155 auto output = ArrayData::Make(data.type, data.length, data.null_count, data.offset);
156 output->buffers.resize(data.buffers.size());
157 for (auto&& [buf, out_buf] : internal::Zip(data.buffers, output->buffers)) {
158 if (buf) {
159 ARROW_ASSIGN_OR_RAISE(out_buf, copy_fn(buf, to));
160 }
161 }
162
163 output->child_data.reserve(data.child_data.size());
164 for (const auto& child : data.child_data) {
165 ARROW_ASSIGN_OR_RAISE(auto copied, CopyToImpl(*child, to, copy_fn));
166 output->child_data.push_back(std::move(copied));
167 }
168
169 if (data.dictionary) {
170 ARROW_ASSIGN_OR_RAISE(output->dictionary, CopyToImpl(*data.dictionary, to, copy_fn));
171 }
172
173 output->statistics = data.statistics;
174
175 return output;
176}
177} // namespace
178
179Result<std::shared_ptr<ArrayData>> ArrayData::CopyTo(

Callers 2

CopyToMethod · 0.85
ViewOrCopyToMethod · 0.85

Calls 7

ZipClass · 0.85
resizeMethod · 0.80
push_backMethod · 0.80
MakeFunction · 0.70
ARROW_ASSIGN_OR_RAISEFunction · 0.50
sizeMethod · 0.45
reserveMethod · 0.45

Tested by

no test coverage detected