Implementation:Apache Flink BulkReaderFormatFactory
| Knowledge Sources | |
|---|---|
| Domains | Connectors, File_Connector |
| Last Updated | 2026-02-09 00:00 GMT |
Overview
A factory interface for creating BulkDecodingFormat instances that configure BulkFormat readers for the file system connector.
Description
BulkReaderFormatFactory is an internal interface that extends DecodingFormatFactory<BulkFormat<RowData, FileSourceSplit>>. It serves as the base interface for factories that produce bulk reading formats within the file system connector's table integration layer.
The key specialization over the parent DecodingFormatFactory is that the createDecodingFormat method is overridden to return BulkDecodingFormat<RowData> rather than the more general DecodingFormat. This ensures that format factories for the file system connector always produce formats compatible with the BulkFormat reader API and the FileSourceSplit split type.
This factory is discovered and instantiated through Flink's FactoryUtil service discovery mechanism using DynamicTableFactory.Context and ReadableConfig format options.
Usage
Implement BulkReaderFormatFactory to register a new bulk reading format (such as Parquet, ORC, or Avro) with the file system connector's table source. The factory is loaded via Java SPI and instantiated by FactoryUtil.createTableFactoryHelper when a table is configured to use the corresponding format.
Code Reference
Source Location
- Repository: Apache_Flink
- File: flink-connectors/flink-connector-files/src/main/java/org/apache/flink/connector/file/table/factories/BulkReaderFormatFactory.java
- Lines: 1-44
Signature
@Internal
public interface BulkReaderFormatFactory
extends DecodingFormatFactory<BulkFormat<RowData, FileSourceSplit>> {
@Override
BulkDecodingFormat<RowData> createDecodingFormat(
DynamicTableFactory.Context context, ReadableConfig formatOptions);
}
Import
import org.apache.flink.connector.file.table.factories.BulkReaderFormatFactory;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| context | DynamicTableFactory.Context | Yes | The table factory context providing catalog, schema, and configuration information. |
| formatOptions | ReadableConfig | Yes | Format-specific configuration options (e.g., compression codec, column projection settings). |
Outputs
| Name | Type | Description |
|---|---|---|
| createDecodingFormat result | BulkDecodingFormat<RowData> | A decoding format that can produce BulkFormat<RowData, FileSourceSplit> instances for reading file data. |
Usage Examples
// Implement a custom bulk reader format factory (e.g., for a new file format)
public class MyFormatFactory implements BulkReaderFormatFactory {
@Override
public String factoryIdentifier() {
return "my-format";
}
@Override
public Set<ConfigOption<?>> requiredOptions() {
return Collections.emptySet();
}
@Override
public Set<ConfigOption<?>> optionalOptions() {
return Collections.singleton(MY_COMPRESSION_OPTION);
}
@Override
public BulkDecodingFormat<RowData> createDecodingFormat(
DynamicTableFactory.Context context,
ReadableConfig formatOptions) {
// Return a BulkDecodingFormat that creates BulkFormat readers
return new MyBulkDecodingFormat(formatOptions);
}
}
// Register via META-INF/services/org.apache.flink.table.factories.Factory