Apache GraphAr C++ Library
The C++ Library for Apache GraphAr
|
#include <filesystem.h>
Public Member Functions | |
FileSystem (std::shared_ptr< arrow::fs::FileSystem > arrow_fs) | |
Create a FileSystem instance. More... | |
Result< std::shared_ptr< arrow::Table > > | ReadFileToTable (const std::string &path, FileType file_type, const util::FilterOptions &options={}) const noexcept |
Read and filter a file as an arrow::Table. More... | |
template<typename T > | |
Result< T > | ReadFileToValue (const std::string &path) const noexcept |
Read a file and convert its bytes to a value of type T. More... | |
template<typename T > | |
Status | WriteValueToFile (const T &value, const std::string &path) const noexcept |
Write a value of type T to a file. More... | |
Status | WriteTableToFile (const std::shared_ptr< arrow::Table > &table, FileType file_type, const std::string &path) const noexcept |
Write a table to a file with a specific type. More... | |
Status | CopyFile (const std::string &src_path, const std::string &dst_path) const noexcept |
Result< IdType > | GetFileNumOfDir (const std::string &dir_path, bool recursive=false) const noexcept |
template<> | |
Result< std::string > | ReadFileToValue (const std::string &path) const noexcept |
template<> | |
Status | WriteValueToFile (const std::string &value, const std::string &path) const noexcept |
This class wraps an arrow::fs::FileSystem and provides methods for reading and writing arrow::Table objects from and to files, as well as performing other file system operations such as copying and counting files.
Definition at line 59 of file filesystem.h.
|
inlineexplicit |
Create a FileSystem instance.
arrow_fs | The arrow::fs::FileSystem to wrap. |
Definition at line 65 of file filesystem.h.
|
noexcept |
Copy a file.
If the destination exists and is a directory, an Status::ArrowError is returned. Otherwise, it is replaced.
Definition at line 259 of file filesystem.cc.
|
noexcept |
Get the number of file of a directory.
the file is not pure file, it can be a directory or other type of file.
Definition at line 268 of file filesystem.cc.
|
noexcept |
Read and filter a file as an arrow::Table.
path | The path of the file to read. |
file_type | The type of the file to read. |
options | Row filter and columns to be selected |
Definition at line 105 of file filesystem.cc.
|
noexcept |
Read a file and convert its bytes to a value of type T.
T | The type to convert the file bytes to. |
path | The path of the file to read. |
Definition at line 168 of file filesystem.cc.
|
noexcept |
Write a table to a file with a specific type.
input_table | The table to write. |
file_type | The type of the output file. |
path | The path of the output file. |
Definition at line 213 of file filesystem.cc.
|
noexcept |
Write a value of type T to a file.
T | The type of the value to be written. |
value | The value to be written. |
path | The path of the file to be written |
Definition at line 190 of file filesystem.cc.