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

Function AsyncAddArrowTextColumn

catboost/python-package/catboost/arrow.cpp:798–837  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

796
797
798 void AsyncAddArrowTextColumn(
799 ui32 flatFeatureIdx,
800 PyObject* capsule,
801 IRawFeaturesOrderDataVisitor* builderVisitor,
802 TVector<std::future<void>>* result
803 ) {
804 auto callback = [=] (TArrowSchemaHolderPtr schema, TArrowArrayHolderPtr array) {
805 auto process = [=] () {
806 try {
807 CB_ENSURE(
808 array->Data.null_count <= 0,
809 "Data with nulls is not supported for text columns"
810 );
811
812 TVector<TString> result(array->Data.length);
813
814 ProcessNonNullableStringColumn(
815 schema,
816 array,
817 "text",
818 [&, flatFeatureIdx](size_t dstObjIdx, TStringBuf value) {
819 result[dstObjIdx] = TString(value);
820 }
821 );
822
823 builderVisitor->AddTextFeature(flatFeatureIdx, result);
824 } catch (...) {
825 ythrow TCatBoostException() << "Error while processing column '" << schema->Data.name << "': "
826 << CurrentExceptionMessage();
827 }
828 };
829
830 result->push_back(std::async(std::move(process)));
831 };
832
833 ProcessArrowArrayStream(
834 capsule,
835 std::move(callback)
836 );
837 }
838
839}

Callers

nothing calls this directly

Calls 6

CurrentExceptionMessageFunction · 0.85
ProcessArrowArrayStreamFunction · 0.85
moveFunction · 0.50
AddTextFeatureMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected