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

Method read

matlab/src/cpp/arrow/matlab/io/csv/proxy/table_reader.cc:54–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54void TableReader::read(libmexclass::proxy::method::Context& context) {
55 namespace mda = ::matlab::data;
56 using namespace libmexclass::proxy;
57 namespace csv = ::arrow::csv;
58 using TableProxy = arrow::matlab::tabular::proxy::Table;
59
60 mda::ArrayFactory factory;
61
62 // Create a file input stream.
63 MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(
64 auto source, arrow::io::ReadableFile::Open(filename, arrow::default_memory_pool()),
65 context, error::FAILED_TO_OPEN_FILE_FOR_READ);
66
67 const ::arrow::io::IOContext io_context;
68 const auto read_options = csv::ReadOptions::Defaults();
69 const auto parse_options = csv::ParseOptions::Defaults();
70 const auto convert_options = csv::ConvertOptions::Defaults();
71
72 // Create a TableReader from the file input stream.
73 MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(
74 auto table_reader,
75 csv::TableReader::Make(io_context, source, read_options, parse_options,
76 convert_options),
77 context, error::CSV_FAILED_TO_CREATE_TABLE_READER);
78
79 // Read a Table from the file.
80 MATLAB_ASSIGN_OR_ERROR_WITH_CONTEXT(const auto table, table_reader->Read(), context,
81 error::CSV_FAILED_TO_READ_TABLE);
82
83 auto table_proxy = std::make_shared<TableProxy>(table);
84 const auto table_proxy_id = ProxyManager::manageProxy(table_proxy);
85
86 const auto table_proxy_id_mda = factory.createScalar(table_proxy_id);
87
88 context.outputs[0] = table_proxy_id_mda;
89}
90
91void TableReader::getFilename(libmexclass::proxy::method::Context& context) {
92 namespace mda = ::matlab::data;

Callers

nothing calls this directly

Calls 1

DefaultsFunction · 0.50

Tested by

no test coverage detected