Package org.apache.iceberg.formats
Interface ModelWriteBuilder<D,S>
- Type Parameters:
D- the output data type produced by the readerS- the type of the schema for the output data type
public interface ModelWriteBuilder<D,S>
Builder interface for creating file writers across supported data file formats. The
FormatModel implementations provide the appropriate ModelWriteBuilder instances.
The ModelWriteBuilder follows the builder pattern to configure and create FileAppender instances that write data to the target output files.
This interface is directly exposed to users for parameterizing when only an appender is required.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Finalizes the configuration and builds theFileAppender.content(FileContent content) Based on the target file content the generatedFileAppenderneeds different configuration.engineSchema(S schema) Sets the engine's representation accepted by the writer.Set a file metadata property in the created file.default ModelWriteBuilder<D, S> Sets multiple file metadata properties in the created file.metricsConfig(MetricsConfig metricsConfig) Sets the metrics configuration used for collecting column metrics for the created file.Overwrite the file if it already exists.Set the file schema.Set a writer configuration property which affects the writer behavior.default ModelWriteBuilder<D, S> Sets multiple writer configuration properties that affect the writer behavior.withAADPrefix(ByteBuffer aadPrefix) Sets the additional authentication data (AAD) prefix used for writing the file.withFileEncryptionKey(ByteBuffer encryptionKey) Sets the encryption key used for writing the file.
-
Method Details
-
schema
Set the file schema. -
engineSchema
Sets the engine's representation accepted by the writer.Some data types require additional type information from the engine schema that cannot be fully expressed by the Iceberg schema or the data itself. For example, a variant type may use a shredded representation that relies on engine-specific metadata to map back to the Iceberg schema.
The engine schema must be aligned with the Iceberg schema, but may include representation details that Iceberg considers equivalent.
-
set
Set a writer configuration property which affects the writer behavior. Writer builders should ignore configuration keys not known for them.- Parameters:
property- a writer config property namevalue- config value- Returns:
- this for method chaining
-
setAll
Sets multiple writer configuration properties that affect the writer behavior. Writer builders should ignore configuration keys not known for them.- Parameters:
properties- writer config properties to set- Returns:
- this for method chaining
-
meta
Set a file metadata property in the created file.- Parameters:
property- a file metadata property namevalue- config value- Returns:
- this for method chaining
-
meta
Sets multiple file metadata properties in the created file.- Parameters:
properties- file metadata properties to set- Returns:
- this for method chaining
-
content
Based on the target file content the generatedFileAppenderneeds different configuration. -
metricsConfig
Sets the metrics configuration used for collecting column metrics for the created file. -
overwrite
ModelWriteBuilder<D,S> overwrite()Overwrite the file if it already exists. By default, overwrite is disabled. -
withFileEncryptionKey
Sets the encryption key used for writing the file. If the writer does not support encryption, then an exception should be thrown. -
withAADPrefix
Sets the additional authentication data (AAD) prefix used for writing the file. If the writer does not support encryption, then an exception should be thrown. -
build
Finalizes the configuration and builds theFileAppender.- Throws:
IOException
-