Installation
The latest version of Iceberg is .Using Spark Shell
To use Iceberg in a Spark shell, add the runtime JAR using the--packages option:
If you want to include Iceberg in your Spark installation permanently, add the
iceberg-spark-runtime JAR to Spark’s jars folder.Using Spark SQL
For Spark SQL with catalog configuration:Configuring Catalogs
Iceberg catalogs enable SQL commands to manage tables and load them by name. Configure catalogs using properties underspark.sql.catalog.(catalog_name).
Hadoop Catalog Example
Create a path-based catalog namedlocal for tables under a warehouse directory:
Hive Metastore Catalog
Configure a Hive-based catalog with session catalog support:Creating Your First Table
1
Create a Simple Table
Use the
CREATE TABLE command to create your first Iceberg table:2
Insert Data
Add data to your table using
INSERT INTO:3
Query Data
Read data from your table:
Row-Level Updates
Iceberg adds row-level SQL updates to Spark:MERGE INTO
Update existing rows and insert new ones in a single operation:DELETE FROM
Remove rows matching a condition:Writing with DataFrames
Iceberg supports the v2 DataFrame write API for programmatic writes:Reading with DataFrames
Load tables by name usingspark.table:
Inspecting Tables
Use metadata tables to inspect table history and snapshots:View Snapshots
View History
View Files
Type Conversion
Spark to Iceberg
When creating tables or writing data, Spark types are automatically converted:Numeric types support promotion during writes. For example, you can write Spark
integer to Iceberg long.Iceberg to Spark
When reading from Iceberg tables:Next Steps
DDL Commands
Learn about CREATE, ALTER, and DROP operations
Query Data
Explore SELECT queries and metadata tables
Write Data
Master INSERT INTO and MERGE INTO operations
Procedures
Maintain tables with stored procedures