| 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 | |
| 1837 | Result<std::shared_ptr<Field>> FieldPath::Get(const Schema& schema) const { |
nothing calls this directly
no test coverage detected