Interface FileWriterBuilder<W extends FileWriter<?,?>,S>

Type Parameters:
W - the concrete writer type the builder produces
S - the type of the engine schema for the input data

public interface FileWriterBuilder<W extends FileWriter<?,?>,S>
A generic builder interface for creating specialized file writers in the Iceberg ecosystem.

This builder provides a unified configuration API for generating various types of content writers:

Each concrete implementation configures the underlying file format writer while adding content-specific metadata and behaviors.

  • Method Details

    • set

      FileWriterBuilder<W,S> set(String property, String value)
      Set a writer configuration property which affects the writer behavior.
      Parameters:
      property - a writer config property name
      value - config value
      Returns:
      this for method chaining
    • setAll

      default FileWriterBuilder<W,S> setAll(Map<String,String> properties)
      Adds the new properties to the writer configuration.
      Parameters:
      properties - a map of writer config properties
      Returns:
      this for method chaining
    • meta

      FileWriterBuilder<W,S> meta(String property, String value)
      Set a file metadata property in the created file.
      Parameters:
      property - a file metadata property name
      value - config value
      Returns:
      this for method chaining
    • meta

      default FileWriterBuilder<W,S> meta(Map<String,String> properties)
      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

      FileWriterBuilder<W,S> metricsConfig(MetricsConfig 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

      FileWriterBuilder<W,S> withFileEncryptionKey(ByteBuffer encryptionKey)
      Sets the encryption key used for writing the file. If the writer does not support encryption, then an exception should be thrown.
    • withAADPrefix

      FileWriterBuilder<W,S> withAADPrefix(ByteBuffer aadPrefix)
      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

      FileWriterBuilder<W,S> partition(StructLike partition)
      Sets the partition value for the Iceberg metadata.
    • keyMetadata

      FileWriterBuilder<W,S> keyMetadata(EncryptionKeyMetadata keyMetadata)
      Sets the encryption key metadata for Iceberg metadata.
    • sortOrder

      FileWriterBuilder<W,S> sortOrder(SortOrder sortOrder)
      Sets the sort order for the Iceberg metadata.
    • schema

      FileWriterBuilder<W,S> schema(Schema schema)
      Set the file schema.
    • engineSchema

      FileWriterBuilder<W,S> engineSchema(S schema)
      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

      default FileWriterBuilder<W,S> equalityFieldIds(List<Integer> fieldIds)
      Sets the equality field ids for the equality delete writer. Only applicable when building an EqualityDeleteWriter.
    • equalityFieldIds

      FileWriterBuilder<W,S> equalityFieldIds(int... fieldIds)
      Sets the equality field ids for the equality delete writer. Only applicable when building an EqualityDeleteWriter.
    • build

      W build() throws IOException
      Throws:
      IOException