Skip to main content

Overview

The FileIO interface is Iceberg’s abstraction for reading and writing data and metadata files. It provides a flexible way to integrate with any storage system while maintaining Iceberg’s guarantees around metadata operations and table commits.

Why FileIO?

Iceberg’s design separates concerns:
  • Metadata Operations: Planning and committing changes (uses FileIO)
  • Data Operations: Reading and writing table data (uses processing engine + FileIO)
  • Physical Layout: Absolute paths allow flexibility in file organization

Key Benefits

  1. No File Renaming: Iceberg never renames files, simplifying storage requirements
  2. Absolute Paths: Metadata tracks full file paths, enabling flexible layouts
  3. Minimal Requirements: Only need read, write, delete, and seek operations
  4. Custom Storage: Support any storage backend with a FileIO implementation

FileIO Interface

The core interface is simple:

Built-in Implementations

Iceberg provides FileIO implementations for common storage systems:

Implementing Custom FileIO

Basic Implementation

Implementing InputFile

Implementing OutputFile

Implementing Seekable Input

Configuration

Loading via Catalog Property

Loading via Java API

Advanced Features

Hadoop Configuration Access

If your FileIO needs Hadoop configuration:

Bulk Delete Operations

Optimize deletes with bulk operations:

Prefix Operations

Implement efficient prefix listing:

Testing Your FileIO

Unit Tests

Performance Considerations

Cache file metadata (size, existence) to reduce storage API calls:
Reuse HTTP connections for better performance:
Batch deletes and list operations when possible to reduce API calls.
Use buffered streams for better throughput:

Best Practices

  1. Thread Safety: Ensure FileIO instances are thread-safe or document thread safety requirements
  2. Resource Cleanup: Always close streams and clients in close() method
  3. Error Handling: Wrap storage exceptions in Iceberg exceptions (RuntimeIOException)
  4. Retry Logic: Implement retries for transient failures
  5. Metrics: Add instrumentation for monitoring (optional)
  6. Documentation: Document custom properties and configuration requirements

Common Use Cases

Cloud Storage Integration

Implement FileIO for cloud storage not natively supported:
  • Oracle Cloud Infrastructure (OCI) Object Storage
  • Cloudflare R2
  • Wasabi
  • MinIO
  • Ceph RADOS Gateway

On-Premises Storage

Integrate with enterprise storage systems:
  • NetApp StorageGRID
  • Pure Storage FlashBlade
  • IBM Cloud Object Storage
  • Scality RING

Custom Protocols

Support custom URI schemes:

Debugging

Enable debug logging:
Configure logging level:

Next Steps

AWS S3 FileIO

See production FileIO implementation for S3

Custom Catalog

Build custom catalog with your FileIO