46 inline static Entry<std::string> kAvroSchemaName{
"write.avro.schema-name",
""};
48 inline static Entry<int64_t> kAvroBufferSize{
"write.avro.buffer-size", 1024 * 1024};
50 inline static Entry<int64_t> kAvroSyncInterval{
"write.avro.sync-interval", 16 * 1024};
53 inline static Entry<bool> kAvroSkipDatum{
"write.avro.skip-datum",
true};
54 inline static Entry<std::string> kAvroCompression{
"write.avro.compression-codec",
56 inline static Entry<std::string> kAvroCompressionLevel{
"write.avro.compression-level",
59 inline static Entry<std::string> kParquetCompression{
"write.parquet.compression-codec",
61 inline static Entry<std::string> kParquetCompressionLevel{
62 "write.parquet.compression-level",
""};
64 inline static Entry<int64_t> kParquetMaxRowGroupRows{
"write.parquet.max-row-group-rows",
71 const std::unordered_map<std::string, std::string>& properties);
81 std::shared_ptr<class FileIO>
io;
83 std::unordered_map<std::string, std::string>
metadata;
85 std::shared_ptr<MetricsConfig> metrics_config = MetricsConfig::Default();
Definition file_writer.h:40
static WriterProperties FromMap(const std::unordered_map< std::string, std::string > &properties)
TODO(gangwu): add table properties with write.avro|parquet|orc.*.
Base writer class to write data from different file formats.
Definition file_writer.h:91
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.
Provide typed configuration helpers.
Metrics configuration for Iceberg tables.
Core Apache Iceberg C++ APIs.
Definition arrow_io_util.h:33
std::expected< T, E > Result
Result alias.
Definition result.h:88
std::function< Result< std::unique_ptr< Writer > >()> WriterFactory
Factory function to create a writer of a specific file format.
Definition file_writer.h:126
Define Result, Status, and error helpers.
Definition arrow_c_data.h:57
Registry of writer factories for different file formats.
Definition file_writer.h:129
static WriterFactory & GetFactory(FileFormatType format_type)
Get the factory function for a specific file format.
WriterFactoryRegistry(FileFormatType format_type, WriterFactory factory)
Register a factory function for a specific file format.
static Result< std::unique_ptr< Writer > > Open(FileFormatType format_type, const WriterOptions &options)
Open a writer for a specific file format.
Options for creating a writer.
Definition file_writer.h:75
WriterProperties properties
Format-specific or implementation-specific properties.
Definition file_writer.h:87
std::string path
The path to the file to write.
Definition file_writer.h:77
std::shared_ptr< Schema > schema
The schema of the data to write.
Definition file_writer.h:79
std::unordered_map< std::string, std::string > metadata
Metadata to write to the file.
Definition file_writer.h:83
std::shared_ptr< class FileIO > io
FileIO instance to create the file.
Definition file_writer.h:81