Package org.apache.iceberg.formats
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 deletesS- the engine-specific schema type describing the input/output dataW- the file format specific writer type produced by the writer functionR- the file format specific reader type produced by the reader functionF- the file schema type used by the underlying file format
- All Implemented Interfaces:
FormatModel<D,S>
- Direct Known Subclasses:
AvroFormatModel,ORCFormatModel,ParquetFormatModel
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA functional interface for creating readers that can read data from a specific format.static interfaceA functional interface for creating writers that can write data in a specific format. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBaseFormatModel(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. -
Method Summary
Modifier and TypeMethodDescriptionprotected BaseFormatModel.ReaderFunction<R, S, F> Returns the reader function used to create readers for this format.Return the schema type class for the object model implementation processed by this factory.type()Return the row type class for the object model implementation processed by this factory.protected BaseFormatModel.WriterFunction<W, S, F> Returns the writer function used to create writers for this format.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.iceberg.formats.FormatModel
format, readBuilder, writeBuilder
-
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 formatreaderFunction- the function used to create readers for this format
-
-
Method Details
-
type
Description copied from interface:FormatModelReturn 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:
typein interfaceFormatModel<D,S> - Returns:
- the type of the data structures handled by this model implementation
-
schemaType
Description copied from interface:FormatModelReturn the schema type class for the object model implementation processed by this factory.- Specified by:
schemaTypein interfaceFormatModel<D,S> - Returns:
- the type of the schema for the data structures handled by this model implementation
-
writerFunction
Returns the writer function used to create writers for this format.- Returns:
- the writer function
-
readerFunction
Returns the reader function used to create readers for this format.- Returns:
- the reader function
-