33#include "iceberg/result.h"
35#include "iceberg/util/config.h"
45 inline static Entry<std::string> kAvroSchemaName{
"write.avro.schema-name",
""};
47 inline static Entry<int64_t> kAvroBufferSize{
"write.avro.buffer-size", 1024 * 1024};
49 inline static Entry<int64_t> kAvroSyncInterval{
"write.avro.sync-interval", 16 * 1024};
52 inline static Entry<bool> kAvroSkipDatum{
"write.avro.skip-datum",
true};
53 inline static Entry<std::string> kAvroCompression{
"write.avro.compression-codec",
55 inline static Entry<std::string> kAvroCompressionLevel{
"write.avro.compression-level",
58 inline static Entry<std::string> kParquetCompression{
"write.parquet.compression-codec",
60 inline static Entry<std::string> kParquetCompressionLevel{
61 "write.parquet.compression-level",
""};
66 static WriterProperties FromMap(
67 const std::unordered_map<std::string, std::string>& properties);
77 std::shared_ptr<class FileIO>
io;
79 std::unordered_map<std::string, std::string>
metadata;
128 static WriterFactory& GetFactory(FileFormatType format_type);
131 static Result<std::unique_ptr<Writer>> Open(FileFormatType format_type,
Definition file_writer.h:39
Base writer class to write data from different file formats.
Definition file_writer.h:85
virtual Status Open(const WriterOptions &options)=0
Open the writer.
virtual Result< Metrics > metrics()=0
Get the file statistics. Only valid after the file is closed.
virtual Result< int64_t > length()=0
Get the file length. This can be called while the writer is still open or after the file is closed.
virtual std::vector< int64_t > split_offsets()=0
Returns a list of recommended split locations, if applicable, empty otherwise. When available,...
virtual Status Write(ArrowArray *data)=0
Write arrow data to the file.
virtual Status Close()=0
Close the writer.
std::function< Result< std::unique_ptr< Writer > >()> WriterFactory
Factory function to create a writer of a specific file format.
Definition file_writer.h:120
Definition arrow_c_data.h:57
Registry of writer factories for different file formats.
Definition file_writer.h:123
Options for creating a writer.
Definition file_writer.h:71
WriterProperties properties
Format-specific or implementation-specific properties.
Definition file_writer.h:81
std::string path
The path to the file to write.
Definition file_writer.h:73
std::shared_ptr< Schema > schema
The schema of the data to write.
Definition file_writer.h:75
std::unordered_map< std::string, std::string > metadata
Metadata to write to the file.
Definition file_writer.h:79
std::shared_ptr< class FileIO > io
FileIO instance to create the file.
Definition file_writer.h:77