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

Method getFieldByName

matlab/src/cpp/arrow/matlab/tabular/proxy/schema.cc:91–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

89}
90
91void Schema::getFieldByName(libmexclass::proxy::method::Context& context) {
92 namespace mda = ::matlab::data;
93 using namespace libmexclass::proxy;
94 using FieldProxy = arrow::matlab::type::proxy::Field;
95 mda::ArrayFactory factory;
96
97 mda::StructArray args = context.inputs[0];
98 const mda::StringArray name_mda = args[0]["Name"];
99 const auto name_utf16 = std::u16string(name_mda[0]);
100 MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(const auto name,
101 arrow::util::UTF16StringToUTF8(name_utf16), context,
102 error::UNICODE_CONVERSION_ERROR_ID);
103 const std::vector<std::string> names = {name};
104 MATLAB_ERROR_IF_NOT_OK_WITH_CONTEXT(schema->CanReferenceFieldsByNames(names), context,
105 error::ARROW_TABULAR_SCHEMA_AMBIGUOUS_FIELD_NAME);
106
107 const auto field = schema->GetFieldByName(name);
108 auto field_proxy = std::make_shared<FieldProxy>(field);
109 const auto field_proxy_id = ProxyManager::manageProxy(field_proxy);
110 context.outputs[0] = factory.createScalar(field_proxy_id);
111}
112
113void Schema::getNumFields(libmexclass::proxy::method::Context& context) {
114 namespace mda = ::matlab::data;

Callers

nothing calls this directly

Calls 2

GetFieldByNameMethod · 0.45

Tested by

no test coverage detected