| 773 | } |
| 774 | |
| 775 | size_t NCB::EstimateIdsLength(const TStringBuf path) { |
| 776 | const auto file = TBlob::FromFile(TString(path)); |
| 777 | const TConstArrayRef<ui8> blob(file.AsUnsignedCharPtr(), file.Size()); |
| 778 | |
| 779 | TPoolMetainfo poolMetainfo; |
| 780 | auto parseMetainfo = [&] (TConstArrayRef<ui8> bytes) { |
| 781 | const auto poolMetainfoParsed = poolMetainfo.ParseFromArray(bytes.data(), bytes.size()); |
| 782 | CB_ENSURE(poolMetainfoParsed); |
| 783 | }; |
| 784 | TVector<TVector<NCB::TQuantizedPool::TChunkDescription>> stringColumnChunks; |
| 785 | bool isFakeColumn = false; |
| 786 | auto parseColumn = [&] (ui32 columnIndex) -> bool { |
| 787 | isFakeColumn = NCB::NQuantizationSchemaDetail::IsFakeIndex(columnIndex, poolMetainfo); |
| 788 | return true; |
| 789 | }; |
| 790 | size_t estimatedIdsLength = 0; |
| 791 | auto parseChunk = [&] (TConstArrayRef<ui8> bytes, ui32 docOffset, ui32 docsInChunkCount) { |
| 792 | const auto* const chunk = flatbuffers::GetRoot<NCB::NIdl::TQuantizedFeatureChunk>(bytes.data()); |
| 793 | if (isFakeColumn && docOffset == 0) { |
| 794 | estimatedIdsLength += 1 + chunk->Quants()->size() / (docsInChunkCount + 1); |
| 795 | } |
| 796 | }; |
| 797 | ParseQuantizedPool( |
| 798 | parseMetainfo, |
| 799 | /*parseSchema*/ Nothing(), |
| 800 | parseColumn, |
| 801 | parseChunk, |
| 802 | blob); |
| 803 | return estimatedIdsLength; |
| 804 | } |
| 805 | |
| 806 | void NCB::EstimateGroupSize( |
| 807 | const TStringBuf path, |
nothing calls this directly
no test coverage detected