Interface FileWriter<T,R>

Type Parameters:
T - the row type
R - the result type
All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
DataWriter, EqualityDeleteWriter, FileScopedPositionDeleteWriter, PositionDeleteWriter, RollingDataWriter, RollingEqualityDeleteWriter, RollingPositionDeleteWriter, SortingPositionOnlyDeleteWriter

public interface FileWriter<T,R> extends Closeable
A writer capable of writing files of a single type (i.e. data/delete) to one spec/partition.

As opposed to FileAppender, this interface should be implemented by classes that not only append records to files but actually produce DataFiles or DeleteFiles objects with Iceberg metadata. Implementations may wrap FileAppenders with extra information such as spec, partition, sort order ID needed to construct DataFiles or DeleteFiles.

  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the number of bytes that were currently written by this writer.
    Returns a result that contains information about written DataFiles or DeleteFiles.
    default void
    write(Iterable<T> rows)
    Writes rows to a predefined spec/partition.
    void
    write(T row)
    Writes a row to a predefined spec/partition.

    Methods inherited from interface java.io.Closeable

    close
  • Method Details

    • write

      default void write(Iterable<T> rows)
      Writes rows to a predefined spec/partition.
      Parameters:
      rows - data or delete records
    • write

      void write(T row)
      Writes a row to a predefined spec/partition.
      Parameters:
      row - a data or delete record
    • length

      long length()
      Returns the number of bytes that were currently written by this writer.
      Returns:
      the number of written bytes
    • result

      R result()
      Returns a result that contains information about written DataFiles or DeleteFiles. The result is valid only after the writer is closed.
      Returns:
      the file writer result