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

Method Get

cpp/src/arrow/type.cc:1810–1834  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1808
1809 template <typename Selector, typename T = typename Selector::ArrowType>
1810 static Result<std::shared_ptr<T>> Get(const FieldPath* path, Selector selector,
1811 int* out_of_range_depth = nullptr) {
1812 if (path->empty()) {
1813 return Status::Invalid("empty indices cannot be traversed");
1814 }
1815
1816 int depth = 0;
1817 for (auto index : *path) {
1818 ARROW_ASSIGN_OR_RAISE(auto next_selector, selector.GetChild(index));
1819
1820 // Handle failed bounds check
1821 if (!next_selector) {
1822 if (out_of_range_depth) {
1823 *out_of_range_depth = depth;
1824 return nullptr;
1825 }
1826 return IndexError(path, depth, selector);
1827 }
1828
1829 selector = std::move(next_selector);
1830 ++depth;
1831 }
1832
1833 return selector.Finish();
1834 }
1835};
1836
1837Result<std::shared_ptr<Field>> FieldPath::Get(const Schema& schema) const {

Callers

nothing calls this directly

Calls 4

IndexErrorFunction · 0.85
InvalidFunction · 0.70
emptyMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected