Interface FileWriterBuilder<W extends FileWriter<?,?>,S>
- Type Parameters:
W- the concrete writer type the builder producesS- the type of the engine schema for the input data
This builder provides a unified configuration API for generating various types of content writers:
DataWriterfor creating data files with table recordsEqualityDeleteWriterfor creating files with equality-based delete recordsPositionDeleteWriterfor creating files with position-based delete records
Each concrete implementation configures the underlying file format writer while adding content-specific metadata and behaviors.
-
Method Summary
Modifier and TypeMethodDescriptionbuild()engineSchema(S schema) Sets the engine-specific schema that describes records accepted by the writer.equalityFieldIds(int... fieldIds) Sets the equality field ids for the equality delete writer.default FileWriterBuilder<W, S> equalityFieldIds(List<Integer> fieldIds) Sets the equality field ids for the equality delete writer.keyMetadata(EncryptionKeyMetadata keyMetadata) Sets the encryption key metadata for Iceberg metadata.Set a file metadata property in the created file.default FileWriterBuilder<W, S> Add the new properties to file metadata for 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.partition(StructLike partition) Sets the partition value for the Iceberg metadata.Set the file schema.Set a writer configuration property which affects the writer behavior.default FileWriterBuilder<W, S> Adds the new properties to the writer configuration.Sets the sort order for the Iceberg metadata.spec(PartitionSpec newSpec) Sets the partition specification for the Iceberg metadata.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
-
set
Set a writer configuration property which affects the writer behavior.- Parameters:
property- a writer config property namevalue- config value- Returns:
- this for method chaining
-
setAll
Adds the new properties to the writer configuration.- Parameters:
properties- a map of writer config properties- 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
Add the new properties to file metadata for the created file.- Parameters:
properties- a map of file metadata properties- Returns:
- this for method chaining
-
metricsConfig
Sets the metrics configuration used for collecting column metrics for the created file. -
overwrite
FileWriterBuilder<W,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. -
spec
Sets the partition specification for the Iceberg metadata. -
partition
Sets the partition value for the Iceberg metadata. -
keyMetadata
Sets the encryption key metadata for Iceberg metadata. -
sortOrder
Sets the sort order for the Iceberg metadata. -
schema
Set the file schema. -
engineSchema
Sets the engine-specific schema that describes records 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, an engine's tinyint or smallint types are mapped to Iceberg's integer type, but the writer may need the original type for proper serialization. Similarly, 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.
-
equalityFieldIds
Sets the equality field ids for the equality delete writer. Only applicable when building anEqualityDeleteWriter. -
equalityFieldIds
Sets the equality field ids for the equality delete writer. Only applicable when building anEqualityDeleteWriter. -
build
- Throws:
IOException
-