MCPcopy Create free account
hub / github.com/catboost/catboost / GatherAndSortChunks

Function GatherAndSortChunks

catboost/private/libs/quantized_pool/loader.cpp:199–232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

197}
198
199static TDeque<TChunkRef> GatherAndSortChunks(const TQuantizedPool& pool) {
200 TDeque<TChunkRef> chunks;
201 for (const auto [columnIdx, localIdx] : pool.ColumnIndexToLocalIndex) {
202 for (const auto& description : pool.Chunks[localIdx]) {
203 chunks.push_back({&description, static_cast<ui32>(columnIdx), static_cast<ui32>(localIdx)});
204 }
205 }
206
207 const ui32 fakeIndices[] = {
208 pool.StringDocIdLocalIndex,
209 pool.StringGroupIdLocalIndex,
210 pool.StringSubgroupIdLocalIndex
211 };
212 for (const auto fakeIdx : fakeIndices) {
213 if (fakeIdx == static_cast<ui32>(-1)) {
214 continue;
215 }
216
217 for (const auto& description : pool.Chunks[fakeIdx]) {
218 chunks.push_back({&description, 0, fakeIdx});
219 }
220 }
221
222 // Sort chunks in ascending order based on the address of the chunks. We'll use it later to
223 // process chunks in the same order as if we were reading them from file one by one
224 // sequentially.
225 Sort(
226 chunks,
227 [](const auto lhs, const auto rhs) {
228 return lhs.Description->Chunk->Quants()->data() < rhs.Description->Chunk->Quants()->data();
229 });
230
231 return chunks;
232}
233
234template <typename T, typename U>
235static void AssignUnaligned(const TConstArrayRef<ui8> unaligned, TVector<U>* dst) {

Callers 1

DoMethod · 0.85

Calls 3

SortFunction · 0.50
push_backMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected