Class BaseFormatModel<D,S,W,R,F>

java.lang.Object
org.apache.iceberg.formats.BaseFormatModel<D,S,W,R,F>
Type Parameters:
D - output type used for reading data, and input type for writing data and deletes
S - the engine-specific schema type describing the input/output data
W - the file format specific writer type produced by the writer function
R - the file format specific reader type produced by the reader function
F - the file schema type used by the underlying file format
All Implemented Interfaces:
FormatModel<D,S>
Direct Known Subclasses:
AvroFormatModel, ORCFormatModel, ParquetFormatModel

public abstract class BaseFormatModel<D,S,W,R,F> extends Object implements FormatModel<D,S>
Base implementation of FormatModel that provides common functionality for format models.

This abstract class serves as a foundation for creating format-specific models that handle reading and writing data in various file formats.

  • Constructor Details

    • BaseFormatModel

      protected BaseFormatModel(Class<? extends D> type, Class<S> schemaType, BaseFormatModel.WriterFunction<W,S,F> writerFunction, BaseFormatModel.ReaderFunction<R,S,F> readerFunction)
      Constructs a new BaseFormatModel with the specified configuration.
      Parameters:
      type - the row type class for the object model implementation processed by this factory.
      schemaType - the schema type class for the object model implementation processed by this factory.
      writerFunction - the function used to create writers for this format
      readerFunction - the function used to create readers for this format
  • Method Details

    • type

      public Class<? extends D> type()
      Description copied from interface: FormatModel
      Return the row type class for the object model implementation processed by this factory.

      The model types act as a contract specifying the expected data structures for both reading (converting file formats into output objects) and writing (converting input objects into file formats). This ensures proper integration between Iceberg's storage layer and processing engines.

      Processing engines can define their own object models by implementing this interface and using their own model name. They can register these models with Iceberg by using the FormatModelRegistry. This allows custom data representations to be seamlessly integrated with Iceberg's file format handlers.

      Specified by:
      type in interface FormatModel<D,S>
      Returns:
      the type of the data structures handled by this model implementation
    • schemaType

      public Class<S> schemaType()
      Description copied from interface: FormatModel
      Return the schema type class for the object model implementation processed by this factory.
      Specified by:
      schemaType in interface FormatModel<D,S>
      Returns:
      the type of the schema for the data structures handled by this model implementation
    • writerFunction

      protected BaseFormatModel.WriterFunction<W,S,F> writerFunction()
      Returns the writer function used to create writers for this format.
      Returns:
      the writer function
    • readerFunction

      protected BaseFormatModel.ReaderFunction<R,S,F> readerFunction()
      Returns the reader function used to create readers for this format.
      Returns:
      the reader function