C++ 从std::vector读取CSV<;无符号字符>;使用apachearrow

C++ 从std::vector读取CSV<;无符号字符>;使用apachearrow,c++,csv,apache-arrow,C++,Csv,Apache Arrow,我正在尝试使用ApacheArrow读取csv输入格式。这个例子提到输入应该是,但是在我的例子中,我只有一个无符号字符的std::vector。是否可以使用ApacheArrow解析此内容?我已经检查了,看看是否有一个“内存中”的数据结构没有运气。 为了方便起见,我将示例代码以及输入数据复制粘贴到此处: #include "arrow/csv/api.h" { // ... std::vector<unsigned char> data; ar

我正在尝试使用ApacheArrow读取csv输入格式。这个例子提到输入应该是,但是在我的例子中,我只有一个无符号字符的std::vector。是否可以使用ApacheArrow解析此内容?我已经检查了,看看是否有一个“内存中”的数据结构没有运气。 为了方便起见,我将示例代码以及输入数据复制粘贴到此处:

#include "arrow/csv/api.h"

{
   // ...
   std::vector<unsigned char> data;
   arrow::io::IOContext io_context = arrow::io::default_io_context();
   // how can I fit the std::vector to the input stream? 
   std::shared_ptr<arrow::io::InputStream> input = ...;

   auto read_options = arrow::csv::ReadOptions::Defaults();
   auto parse_options = arrow::csv::ParseOptions::Defaults();
   auto convert_options = arrow::csv::ConvertOptions::Defaults();

   // Instantiate TableReader from input stream and options
   auto maybe_reader =
     arrow::csv::TableReader::Make(io_context,
                                   input,
                                   read_options,
                                   parse_options,
                                   convert_options);
   if (!maybe_reader.ok()) {
      // Handle TableReader instantiation error...
   }
   std::shared_ptr<arrow::csv::TableReader> reader = *maybe_reader;

   // Read table from CSV file
   auto maybe_table = reader->Read();
   if (!maybe_table.ok()) {
      // Handle CSV read error
      // (for example a CSV syntax error or failed type conversion)
   }
   std::shared_ptr<arrow::Table> table = *maybe_table;
}
#包括“arrow/csv/api.h”
{
// ...
std::矢量数据;
arrow::io::IOContext io_context=arrow::io::default_io_context();
//如何使std::vector适合输入流?
std::共享的ptr输入=。。。;
自动读取选项=箭头::csv::读取选项::默认值();
自动解析选项=箭头::csv::解析选项::默认值();
自动转换选项=箭头::csv::转换选项::默认值();
//从输入流和选项实例化TableReader
自动读卡器=
arrow::csv::TableReader::Make(io_上下文,
输入,
阅读选项,
解析所有选项,
转换(U选项);
如果(!maybe_reader.ok()){
//处理TableReader实例化错误。。。
}
std::shared_ptr reader=*可能是_reader;
//从CSV文件中读取表
自动读取表=读卡器->读取();
如果(!maybe_table.ok()){
//处理CSV读取错误
//(例如CSV语法错误或类型转换失败)
}
std::shared_ptr table=*maybe_table;
}

任何帮助都将不胜感激

I/O接口文档列表,用作内存中的输入流。虽然没有在文档中列出,但它应该允许您使用
向量