27 #include "graphar/result.h"
28 #include "graphar/status.h"
29 #include "graphar/types.h"
30 #include "graphar/util.h"
32 #include "graphar/reader_util.h"
45 class RandomAccessFile;
48 namespace arrow::dataset {
65 explicit FileSystem(std::shared_ptr<arrow::fs::FileSystem> arrow_fs)
66 : arrow_fs_(arrow_fs) {}
80 const std::string& path, FileType file_type,
102 template <
typename T>
114 FileType file_type,
const std::string& path)
const
123 Status
CopyFile(
const std::string& src_path,
124 const std::string& dst_path)
const noexcept;
132 bool recursive =
false) const noexcept;
135 std::shared_ptr<arrow::dataset::FileFormat> GetFileFormat(
136 const FileType file_type) const;
139 std::shared_ptr<arrow::fs::
FileSystem> arrow_fs_;
153 Result<std::shared_ptr<
FileSystem>> FileSystemFromUriOrPath(
154 const std::
string& uri, std::
string* out_path =
nullptr);
166 Status InitializeS3();
FileSystem(std::shared_ptr< arrow::fs::FileSystem > arrow_fs)
Create a FileSystem instance.
Result< IdType > GetFileNumOfDir(const std::string &dir_path, bool recursive=false) const noexcept
Status WriteValueToFile(const T &value, const std::string &path) const noexcept
Write a value of type T to a file.
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.
Result< T > ReadFileToValue(const std::string &path) const noexcept
Read a file and convert its bytes to a value of type T.
Status CopyFile(const std::string &src_path, const std::string &dst_path) const noexcept
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.