Interface FormatModel<D,S>
- Type Parameters:
D- output type used for reading data, and input type for writing data and deletesS- the type of the schema for the input/output data
- All Known Implementing Classes:
AvroFormatModel,BaseFormatModel,ORCFormatModel,ParquetFormatModel
FormatModel serves as a bridge between storage formats (FileFormat) and
expected input/output data structures, optimizing performance through direct conversion without
intermediate representations. File format implementations handle the low-level parsing details
while the object model determines the in-memory representation used for the parsed data.
Together, these provide a consistent API for consuming data files while optimizing for specific
processing engines.
Iceberg provides some built-in object models and processing engines can implement custom object models to integrate with Iceberg's file reading and writing capabilities.
-
Method Summary
Modifier and TypeMethodDescriptionformat()The file format which is read/written by the object model.readBuilder(InputFile inputFile) Creates a file reader builder for the specified input file.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.writeBuilder(EncryptedOutputFile outputFile) Creates a writer builder for data files.
-
Method Details
-
format
FileFormat format()The file format which is read/written by the object model. -
type
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.- Returns:
- the type of the data structures handled by this model implementation
-
schemaType
Return the schema type class for the object model implementation processed by this factory.- Returns:
- the type of the schema for the data structures handled by this model implementation
-
writeBuilder
Creates a writer builder for data files.The returned
ModelWriteBuilderconfigures and creates a writer that converts input objects into the file format supported by this factory.- Parameters:
outputFile- destination for the written data- Returns:
- configured writer builder
-
readBuilder
Creates a file reader builder for the specified input file.The returned
ReadBuilderconfigures and creates a reader that converts data from the file format into output objects supported by this factory.- Parameters:
inputFile- source file to read from- Returns:
- configured reader builder for the specified input
-