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

Method getColumnNames

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

Source from the content-addressed store, hash-verified

136}
137
138void RecordBatch::getColumnNames(libmexclass::proxy::method::Context& context) {
139 namespace mda = ::matlab::data;
140 mda::ArrayFactory factory;
141 const int num_columns = record_batch->num_columns();
142
143 std::vector<mda::MATLABString> column_names;
144 for (int i = 0; i < num_columns; ++i) {
145 const auto column_name_utf8 = record_batch->column_name(i);
146 MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(auto column_name_utf16,
147 arrow::util::UTF8StringToUTF16(column_name_utf8),
148 context, error::UNICODE_CONVERSION_ERROR_ID);
149 const mda::MATLABString matlab_string =
150 mda::MATLABString(std::move(column_name_utf16));
151 column_names.push_back(matlab_string);
152 }
153 auto column_names_mda =
154 factory.createArray({size_t{1}, static_cast<size_t>(num_columns)},
155 column_names.begin(), column_names.end());
156 context.outputs[0] = column_names_mda;
157}
158
159void RecordBatch::getColumnByIndex(libmexclass::proxy::method::Context& context) {
160 namespace mda = ::matlab::data;

Callers

nothing calls this directly

Calls 4

push_backMethod · 0.80
num_columnsMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected