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

Method GetLastIndices

cpp/src/arrow/dataset/scanner_test.cc:1780–1788  ·  view source on GitHub ↗

Given a vector of fragment indices (one per batch) return a vector (one per fragment) mapping fragment index to the last occurrence of that index in order This allows us to know when to mark a fragment as finished

Source from the content-addressed store, hash-verified

1778 //
1779 // This allows us to know when to mark a fragment as finished
1780 std::vector<int> GetLastIndices(const std::vector<int>& order) {
1781 std::vector<int> last_indices(kNumFragments);
1782 for (std::size_t i = 0; i < kNumFragments; i++) {
1783 auto last_p = std::find(order.rbegin(), order.rend(), static_cast<int>(i));
1784 EXPECT_NE(last_p, order.rend());
1785 last_indices[i] = static_cast<int>(std::distance(last_p, order.rend())) - 1;
1786 }
1787 return last_indices;
1788 }
1789
1790 /// We buffer one item in order to enumerate it (technically this could be avoided if
1791 /// delivering in order but easier to have a single code path). We also can't deliver

Callers

nothing calls this directly

Calls 2

rbeginMethod · 0.80
rendMethod · 0.80

Tested by

no test coverage detected