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

Method Get

cpp/src/arrow/type.cc:1813–1837  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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