| 775 | |
| 776 | |
| 777 | TObjectsDataProviderPtr NCB::TRawObjectsDataProvider::GetSubsetImpl( |
| 778 | const TObjectsGroupingSubset& objectsGroupingSubset, |
| 779 | TMaybe<TConstArrayRef<ui32>> ignoredFeatures, |
| 780 | ui64 cpuRamLimit, |
| 781 | NPar::ILocalExecutor* localExecutor |
| 782 | ) const { |
| 783 | TCommonObjectsData subsetCommonData = CommonData.GetSubset( |
| 784 | objectsGroupingSubset, |
| 785 | localExecutor |
| 786 | ); |
| 787 | |
| 788 | // needed only for sparse features |
| 789 | TMaybe<TFeaturesArraySubsetInvertedIndexing> subsetInvertedIndexing; |
| 790 | |
| 791 | if (CommonData.FeaturesLayout->HasSparseFeatures()) { |
| 792 | subsetInvertedIndexing.ConstructInPlace( |
| 793 | GetInvertedIndexing(objectsGroupingSubset.GetObjectsIndexing(), GetObjectCount(), localExecutor) |
| 794 | ); |
| 795 | } |
| 796 | |
| 797 | if (ignoredFeatures.Defined()) { |
| 798 | subsetCommonData.FeaturesLayout = MakeIntrusive<TFeaturesLayout>(*subsetCommonData.FeaturesLayout); |
| 799 | subsetCommonData.FeaturesLayout->IgnoreExternalFeatures(*ignoredFeatures); |
| 800 | } |
| 801 | |
| 802 | auto resourceConstrainedExecutor = CreateCpuRamConstrainedExecutor(cpuRamLimit, localExecutor); |
| 803 | |
| 804 | TRawObjectsData subsetData; |
| 805 | |
| 806 | auto getSubsetWithScheduling = [&] (const auto& srcFeatures, auto* dstFeatures) { |
| 807 | GetSubsetWithScheduling( |
| 808 | MakeConstArrayRef(srcFeatures), |
| 809 | subsetCommonData.SubsetIndexing.Get(), |
| 810 | subsetInvertedIndexing, |
| 811 | &resourceConstrainedExecutor, |
| 812 | dstFeatures |
| 813 | ); |
| 814 | }; |
| 815 | |
| 816 | getSubsetWithScheduling(Data.FloatFeatures, &subsetData.FloatFeatures); |
| 817 | getSubsetWithScheduling(Data.CatFeatures, &subsetData.CatFeatures); |
| 818 | getSubsetWithScheduling(Data.TextFeatures, &subsetData.TextFeatures); |
| 819 | getSubsetWithScheduling(Data.EmbeddingFeatures, &subsetData.EmbeddingFeatures); |
| 820 | |
| 821 | resourceConstrainedExecutor.ExecTasks(); |
| 822 | |
| 823 | return MakeIntrusive<TRawObjectsDataProvider>( |
| 824 | objectsGroupingSubset.GetSubsetGrouping(), |
| 825 | std::move(subsetCommonData), |
| 826 | std::move(subsetData), |
| 827 | true, |
| 828 | Nothing() |
| 829 | ); |
| 830 | } |
| 831 | |
| 832 | template <class T> |
| 833 | static bool HasDenseData(const TVector<THolder<T>>& columns) { |
nothing calls this directly
no test coverage detected