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

Method getColumnByName

matlab/src/cpp/arrow/matlab/tabular/proxy/record_batch.cc:187–206  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

185}
186
187void RecordBatch::getColumnByName(libmexclass::proxy::method::Context& context) {
188 namespace mda = ::matlab::data;
189
190 mda::StructArray args = context.inputs[0];
191 const mda::StringArray name_mda = args[0]["Name"];
192 const auto name_utf16 = std::u16string(name_mda[0]);
193 MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(const auto name,
194 arrow::util::UTF16StringToUTF8(name_utf16), context,
195 error::UNICODE_CONVERSION_ERROR_ID);
196
197 const std::vector<std::string> names = {name};
198 const auto& schema = record_batch->schema();
199 MATLAB_ERROR_IF_NOT_OK_WITH_CONTEXT(schema->CanReferenceFieldsByNames(names), context,
200 error::ARROW_TABULAR_SCHEMA_AMBIGUOUS_FIELD_NAME);
201
202 const auto array = record_batch->GetColumnByName(name);
203 MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(context.outputs[0],
204 arrow::matlab::proxy::wrap_and_manage(array),
205 context, error::UNKNOWN_PROXY_FOR_ARRAY_TYPE);
206}
207
208void RecordBatch::getSchema(libmexclass::proxy::method::Context& context) {
209 namespace mda = ::matlab::data;

Callers

nothing calls this directly

Calls 4

wrap_and_manageFunction · 0.85
GetColumnByNameMethod · 0.80
schemaMethod · 0.45

Tested by

no test coverage detected