Apache Iceberg Java API
The Apache Iceberg Java API provides a comprehensive set of interfaces for working with Iceberg tables. This reference documentation covers the core APIs used for table operations, schema management, partitioning, sorting, and snapshots.Core APIs
Iceberg’s Java API is built around several key interfaces:Table API
TheTable interface is the primary entry point for interacting with Iceberg tables. It provides methods for:
- Reading and writing data
- Managing table metadata
- Creating scans and queries
- Updating schemas, partition specs, and sort orders
- Managing snapshots and history
Schema API
TheSchema class defines the structure of table data. It provides:
- Column definitions and types
- Field identification and lookup
- Schema evolution capabilities
- Identifier field management
PartitionSpec API
ThePartitionSpec class defines how data is partitioned in a table. It supports:
- Multiple partition transforms (identity, bucket, truncate, year, month, day, hour)
- Partition evolution
- Efficient data organization
SortOrder API
TheSortOrder class defines how data files should be sorted. It provides:
- Multi-column sorting
- Custom sort directions and null ordering
- Sort order evolution
Snapshot API
TheSnapshot interface represents a table state at a specific point in time. It enables:
- Time travel queries
- Snapshot metadata access
- Manifest and data file tracking
Package Structure
All core APIs are in theorg.apache.iceberg package:
Common Patterns
Loading a Table
Reading Table Metadata
Scanning Data
Updating Data
Thread Safety
All Iceberg table operations are designed to be thread-safe and support concurrent modifications through optimistic concurrency control.Next Steps
Table API
Explore the Table interface and its methods
Schema API
Learn about schema management and evolution
PartitionSpec API
Understand partition specifications and transforms
SortOrder API
Configure how data files are sorted