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

Method NLastChildren

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

Create a stable C pointer to the N last structs in nested_structs_

Source from the content-addressed store, hash-verified

2606
2607 // Create a stable C pointer to the N last structs in nested_structs_
2608 struct ArrowArray** NLastChildren(int64_t n_children, struct ArrowArray* parent) {
2609 children_arrays_.emplace_back(n_children);
2610 struct ArrowArray** children = children_arrays_.back().data();
2611 int64_t nested_offset;
2612 // If parent is itself at the end of nested_structs_, skip it
2613 if (parent != nullptr && &nested_structs_.back() == parent) {
2614 nested_offset = static_cast<int64_t>(nested_structs_.size()) - n_children - 1;
2615 } else {
2616 nested_offset = static_cast<int64_t>(nested_structs_.size()) - n_children;
2617 }
2618 for (int64_t i = 0; i < n_children; ++i) {
2619 children[i] = &nested_structs_[nested_offset + i];
2620 }
2621 return children;
2622 }
2623
2624 struct ArrowArray* LastChild(struct ArrowArray* parent = nullptr) {
2625 return *NLastChildren(1, parent);

Callers

nothing calls this directly

Calls 4

emplace_backMethod · 0.80
backMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected