26 #include "graphar/result.h"
27 #include "graphar/status.h"
28 #include "graphar/types.h"
29 #include "graphar/util.h"
31 #include "graphar/reader_util.h"
32 #include "graphar/writer_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,
84 const std::string& path, FileType file_type,
85 const std::vector<int>& column_indices)
const noexcept;
106 template <
typename T>
119 FileType file_type,
const std::string& path,
120 const std::shared_ptr<WriterOptions>& options)
const
130 const std::string& path)
const noexcept;
138 Status
CopyFile(
const std::string& src_path,
139 const std::string& dst_path)
const noexcept;
147 bool recursive =
false) const noexcept;
150 std::shared_ptr<arrow::dataset::FileFormat> GetFileFormat(
151 const FileType file_type) const;
154 std::shared_ptr<arrow::fs::
FileSystem> arrow_fs_;
168 Result<std::shared_ptr<
FileSystem>> FileSystemFromUriOrPath(
169 const std::
string& uri, std::
string* out_path =
nullptr);
181 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.
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.
Status WriteLabelTableToFile(const std::shared_ptr< arrow::Table > &table, const std::string &path) const noexcept
Write a label table to a file with parquet type.
Status WriteTableToFile(const std::shared_ptr< arrow::Table > &table, FileType file_type, const std::string &path, const std::shared_ptr< WriterOptions > &options) const noexcept
Write a table to a file with a specific type.