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

Method getFieldNames

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

Source from the content-addressed store, hash-verified

121}
122
123void Schema::getFieldNames(libmexclass::proxy::method::Context& context) {
124 namespace mda = ::matlab::data;
125 mda::ArrayFactory factory;
126
127 const auto field_names_utf8 = schema->field_names();
128 const auto num_fields = static_cast<size_t>(schema->num_fields());
129
130 std::vector<std::u16string> field_names_utf16;
131 field_names_utf16.reserve(num_fields);
132
133 // Convert the field names from UTF-8 to UTF-16.
134 for (const auto& field_name_utf8 : field_names_utf8) {
135 MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(const auto field_name_utf16,
136 arrow::util::UTF8StringToUTF16(field_name_utf8),
137 context, error::UNICODE_CONVERSION_ERROR_ID);
138 field_names_utf16.push_back(field_name_utf16);
139 }
140
141 const auto field_names_mda = factory.createArray(
142 {1, num_fields}, field_names_utf16.cbegin(), field_names_utf16.cend());
143
144 context.outputs[0] = field_names_mda;
145}
146
147} // namespace arrow::matlab::tabular::proxy

Callers

nothing calls this directly

Calls 6

field_namesMethod · 0.80
push_backMethod · 0.80
cbeginMethod · 0.80
cendMethod · 0.80
num_fieldsMethod · 0.45
reserveMethod · 0.45

Tested by

no test coverage detected