Apache XTable quickstart: Hudi to Iceberg and Delta in 15 minutes
A lab you can run in Docker with one small jar from Maven Central: write a Hudi table, convert it, read it three ways, then append and watch the second sync run incrementally.
- What you need
- 1. Write a Hudi table
- 2. Run the sync
- 3. Look at what was written
- 4. Read it as Iceberg and as Delta
- 5. Append and sync again
- What to check next
- Checked against the source
- Key takeaways
- References
- Trademarks
TL;DR
You need Docker and about 15 minutes. The Spark runtime jar is small and comes from Maven Central, so nothing has to be built.
- Write a Hudi table, run
XTableSparkSyncwith Iceberg and Delta as targets, and the same directory reads as all three.- The first sync takes a snapshot pass and says so. The second takes an incremental pass and says nothing.
- The sync adds
metadata/and_delta_log/beside the Hudi.hoodie/. The Parquet files are untouched.- A success line means metadata was written. Compare counts to know it describes the same table.
This is the shortest path to a working conversion. It uses the Spark runtime jar
because it is published, small, and runs inside a Spark you already know. The
RunSync CLI does the same job, but it has to be built from source, and the
cheat sheet
covers that. The commands below were run end to end in a clean container, on XTable
0.5.0-incubating, Spark 3.5.9 and Hudi 1.2.1.

What you need
Docker, and an internet connection for Maven Central. Start a Spark container with a folder mounted for the lab files:
mkdir lab && cd lab
docker run -it --rm -u root -v "$PWD":/lab -w /lab apache/spark:3.5.9-python3 bash
Everything below runs inside that container. Download the runtime jar once:
export HOME=/tmp
curl -sLO https://repo1.maven.org/maven2/org/apache/xtable/xtable-spark-runtime_2.12/0.5.0-incubating/xtable-spark-runtime_2.12-0.5.0-incubating.jar
The file is 4,573,834 bytes. It holds only XTable. The Hudi, Iceberg and Delta
libraries come from --packages in each command, which is what keeps it small.
1. Write a Hudi table
Save as write_trips.py. It writes n trips, partitioned by city:
import sys
from pyspark.sql import SparkSession
spark = SparkSession.builder.getOrCreate()
mode, n = sys.argv[1], int(sys.argv[2])
trips = spark.createDataFrame(
[("trip-%d" % (1001 + i), "rider-%d" % (10 + i % 5), round(10 + i * 7.25, 2),
1758000000 + i * 60, ["sf", "nyc"][i % 2]) for i in range(n)],
["trip_id", "rider_id", "fare_amount", "updated_at", "city_id"])
(trips.write.format("hudi")
.option("hoodie.table.name", "trips")
.option("hoodie.datasource.write.recordkey.field", "trip_id")
.option("hoodie.datasource.write.precombine.field", "updated_at")
.option("hoodie.datasource.write.partitionpath.field", "city_id")
.option("hoodie.datasource.write.hive_style_partitioning", "true")
.mode(mode).save("file:///lab/trips"))
/opt/spark/bin/spark-submit --master 'local[2]' \
--packages org.apache.hudi:hudi-spark3.5-bundle_2.12:1.2.1 \
--conf spark.serializer=org.apache.spark.serializer.KryoSerializer \
--conf spark.sql.extensions=org.apache.spark.sql.hudi.HoodieSparkSessionExtension \
--conf spark.sql.catalog.spark_catalog=org.apache.spark.sql.hudi.catalog.HoodieCatalog \
write_trips.py overwrite 6
The table now has a .hoodie/ directory and two partition folders, city_id=nyc and city_id=sf.
2. Run the sync
/opt/spark/bin/spark-submit --master 'local[2]' \
--packages org.apache.hudi:hudi-spark3.5-bundle_2.12:1.2.1,org.apache.iceberg:iceberg-spark-runtime-3.5_2.12:1.9.2,io.delta:delta-spark_2.12:3.3.2,io.delta:delta-kernel-api:4.0.0,io.delta:delta-kernel-defaults:4.0.0 \
--conf spark.serializer=org.apache.spark.serializer.KryoSerializer \
--class org.apache.xtable.spark.XTableSparkSync \
xtable-spark-runtime_2.12-0.5.0-incubating.jar \
--basepath file:///lab/trips \
--sourceformat HUDI \
--targets ICEBERG,DELTA \
--partitionspec city_id:VALUE
The output is noisy. Two lines matter:
INFO ConversionController: No previous InternalTable sync for target. Falling back to snapshot sync.
INFO ConversionController: Sync is successful for the following formats ICEBERG,DELTA
The first line appears once per target and is not a problem. A first run has no
record of an earlier sync, so the controller takes a snapshot pass. You will also
see Delta Kernel TableNotFound reports at INFO level. The Delta target does not
exist yet, and that is how it finds out.

The --packages list is long for a reason. Delta on Spark 3.5 uses Delta Kernel,
which needs delta-kernel-api and delta-kernel-defaults. Leave them out and the Delta target
fails with NoClassDefFoundError: io/delta/kernel/engine/Engine. Kernel’s writer has
limits that this table does not hit, because its partition is a plain column: it cannot
evolve a Delta table’s schema or write time and bucket partitions. The
compatibility post has them.
3. Look at what was written
ls -a trips
city_id=nyc city_id=sf _delta_log .hoodie metadata
.hoodie was there before the sync. metadata/ and _delta_log/ are new. They
describe the same Parquet files in Iceberg’s and Delta’s terms. The
architecture post
explains what each holds and how XTable produced it.

4. Read it as Iceberg and as Delta
Save as read_all.py:
import sys
from pyspark.sql import SparkSession
spark = SparkSession.builder.getOrCreate()
fmt = sys.argv[1]
df = spark.read.format(fmt).load("file:///lab/trips")
print("RES", fmt, df.count(), sorted((r[0], r[1]) for r in df.groupBy("city_id").count().collect()))
# Iceberg
/opt/spark/bin/spark-submit --master 'local[2]' \
--packages org.apache.iceberg:iceberg-spark-runtime-3.5_2.12:1.9.2 \
--conf spark.sql.extensions=org.apache.iceberg.spark.extensions.IcebergSparkSessionExtensions \
--conf spark.sql.catalog.spark_catalog=org.apache.iceberg.spark.SparkSessionCatalog \
read_all.py iceberg
# Delta
/opt/spark/bin/spark-submit --master 'local[2]' \
--packages io.delta:delta-spark_2.12:3.3.2 \
--conf spark.sql.extensions=io.delta.sql.DeltaSparkSessionExtension \
--conf spark.sql.catalog.spark_catalog=org.apache.spark.sql.delta.catalog.DeltaCatalog \
read_all.py delta
RES iceberg 6 [('nyc', 3), ('sf', 3)]
RES delta 6 [('nyc', 3), ('sf', 3)]
Six rows and the same count per city, from two formats the table was never written in.
5. Append and sync again
Writing eight trips with append updates the six existing keys and adds two. Run
write_trips.py append 8 with the same command as step 1, then repeat the sync from step 2.
This time the controller prints only the success line, with no snapshot-fallback message. That is how you recognise an incremental pass: it speaks up only when it has to fall back.
ls trips/metadata | grep json
ls trips/_delta_log | grep json
v1.metadata.json v2.metadata.json v3.metadata.json v4.metadata.json
00000000000000000000.json 00000000000000000001.json
Iceberg added v4.metadata.json, and Delta added a second commit. Reading Iceberg again returned
eight rows, four per city.
What to check next
- A success line is not proof. Compare counts across formats, as in the Hudi source post.
- Try another source. The Iceberg and Delta, Paimon and Parquet posts start from tables written by those formats.
- Look at the metadata. The Hudi
.hoodie/timeline, the Iceberg manifests and the Delta JSON are all small text and Avro files you can open.
Checked against the source
| Claim | Where |
|---|---|
| The Spark runtime’s entry point and options | XTableSparkSync in xtable-spark-runtime |
| First run falls back to a snapshot sync | ConversionController, the “No previous InternalTable sync for target” branch |
| A target’s sync state decides the next mode | TableSyncMetadata, ConversionController.getFormatsToSyncIncrementally |
| Delta on Spark 3.5 uses Delta Kernel | Spark runtime documentation and the NoClassDefFoundError seen when the jars are missing |
The commands and outputs are from one clean run in Docker.
Key takeaways
A conversion is four commands: write, sync, read, sync again. What to remember is how the controller reports it: a snapshot line on the first run, a success line on every run, and nothing else when an incremental pass goes well. The rest of the series explains what each of those lines costs and when they change.
References
Trademarks
Apache XTable (incubating), Apache Hudi, Apache Iceberg, Apache Spark and Apache are either registered trademarks or trademarks of The Apache Software Foundation in the United States and other countries. Delta Lake is a trademark of the Linux Foundation. All other marks are the property of their respective owners.
Found this useful?
These posts and tools are free. If one saved you an afternoon, you can buy me a coffee.
Comments
Questions, corrections and reviews are welcome. Sign in with GitHub to post; comments are stored in this site's public GitHub Discussions.