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

Method getColumnByName

matlab/src/cpp/arrow/matlab/tabular/proxy/table.cc:265–290  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265void Table::getColumnByName(libmexclass::proxy::method::Context& context) {
266 using ChunkedArrayProxy = arrow::matlab::array::proxy::ChunkedArray;
267 namespace mda = ::matlab::data;
268 using namespace libmexclass::proxy;
269 mda::ArrayFactory factory;
270
271 mda::StructArray args = context.inputs[0];
272 const mda::StringArray name_mda = args[0]["Name"];
273 const auto name_utf16 = std::u16string(name_mda[0]);
274 MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(const auto name,
275 arrow::util::UTF16StringToUTF8(name_utf16), context,
276 error::UNICODE_CONVERSION_ERROR_ID);
277
278 const std::vector<std::string> names = {name};
279 const auto& schema = table->schema();
280 MATLAB_ERROR_IF_NOT_OK_WITH_CONTEXT(schema->CanReferenceFieldsByNames(names), context,
281 error::ARROW_TABULAR_SCHEMA_AMBIGUOUS_FIELD_NAME);
282
283 const auto chunked_array = table->GetColumnByName(name);
284 const auto chunked_array_proxy = std::make_shared<ChunkedArrayProxy>(chunked_array);
285
286 const auto chunked_array_proxy_id = ProxyManager::manageProxy(chunked_array_proxy);
287 const auto chunked_array_proxy_id_mda = factory.createScalar(chunked_array_proxy_id);
288
289 context.outputs[0] = chunked_array_proxy_id_mda;
290}
291
292void Table::getRowAsString(libmexclass::proxy::method::Context& context) {
293 namespace mda = ::matlab::data;

Callers

nothing calls this directly

Calls 3

GetColumnByNameMethod · 0.80
schemaMethod · 0.45

Tested by

no test coverage detected