如何解决读取包含数据类型为 arrow::large_utf8() 的列的羽毛文件时出现分段错误
我已经编写了 C++ 代码来读取羽毛文件并将数据插入到一个箭头::表中,但是如果文件包含任何数据类型为箭头::large_utf8 的列,则会出现分段错误。它仅针对此数据类型给出段错误,utf8/int/float 数据类型没有错误。
我认为用于读/写的羽毛 API 实现有问题,因为如果我对镶木地板文件执行相同操作,它就可以正常工作。
我发现了一个与同一问题密切相关的链接,但它与 python - https://github.com/pandas-dev/pandas/issues/24767
有没有人知道为什么会有这种行为?
arrow::Status write_to_feather(std::string path,std::shared_ptr <arrow::Table> table) {
arrow::fs::LocalFileSystem file_system;
auto output = file_system.OpenOutputStream(path).ValueOrDie();
ABORT_ON_FAILURE(arrow::ipc::feather::WriteTable(*table,output.get()));
return arrow::Status::OK();
}
void read_feather_to_table(std::string path,std::shared_ptr<arrow::Table> *feather_table){
arrow::fs::LocalFileSystem file_system;
std::shared_ptr <arrow::io::RandomAccessFile> input_file = file_system.OpenInputFile(path).ValueOrDie();
std::shared_ptr <arrow::ipc::feather::Reader> feather_reader = arrow::ipc::feather::Reader::Open(input_file).ValueOrDie();
arrow::Status temp_status = feather_reader -> Read(feather_table);
if(temp_status.ok()){
std::cout << "Read feather file Successfully." << std::endl;
std::cout << ((*feather_table).get()) -> ToString() << std::endl; // this line gives segfault
}
else{
std::cout << "Feather file reading process Failed." << std::endl;
}
return;
}
当我使用 write_to_feather 编写一个包含 large_utf8 数据类型的任何列的表时,我的 read_feather_to_table 函数给出了段错误,而在所有其他情况下,这两个函数都可以正常工作。当我尝试打印上面代码中指定的表格内容时,会发生段错误。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。