Apache XTable with Hudi: versions, Merge-on-Read, cleaner races
A worked Hudi sync, the table versions XTable reads and writes, what a Merge-on-Read table converts as, and the failure when Hudi's cleaner deletes files a lagging target still lists.
- Sync a Hudi table to Iceberg and Delta
- Which Hudi table versions XTable reads and writes
- Copy-on-Write converts, Merge-on-Read converts as read-optimized
- When the cleaner outruns the target
- Check the converted table
- Failures you can hit with a Hudi source
- Key takeaways
- References
- Trademarks
TL;DR
With Hudi as the source, XTable reads the commit timeline and file slices and writes Iceberg and Delta metadata over the same Parquet files. Nothing is copied.
Everything else follows from that sentence:
- The source decides what converts. A copy-on-write table converts in full, and a merge-on-read table converts as its read-optimized view because log files are not captured.
- XTable reads Hudi table versions 6, 8 and 9. A Hudi target is written as version 6 unless you set
xtable.hudi.target.table_versionto9.- Hudi’s cleaner decides how long files live. A target that lags behind the cleaner window lists files that no longer exist, and reads fail until the next sync.
- The Hudi metadata columns (
_hoodie_*) appear in the converted schema.- A success line in the log says metadata was written. Comparing counts across formats says whether it describes the same table.
A team ingests into Hudi because the pipeline needs upserts. The warehouse reads
Iceberg because that is what the warehouse reads. XTable closes the gap by
writing a second set of metadata beside the Hudi one, and the questions worth
asking are all about the Hudi side: which tables convert, which versions it
reads, and what Hudi’s own table services do to the copies. The answers
below were checked on 0.5.0-incubating. The build, the flags and the other sources are in the
cheat sheet, and how the sync chooses
between a full and an incremental pass is in the
incremental sync post.
Sync a Hudi table to Iceberg and Delta
Every step below was run on Spark 3.5.9 (apache/spark:3.5.9-python3, Scala
2.12, Java 11), with the XTable CLI built from the 0.5.0-incubating tag, as described in
the cheat sheet. The writer is Hudi 1.2.1, the Spark 3.5 bundle, which writes table
version 9, the same version XTable’s bundled Hudi 1.2.1 writes. The Iceberg
reader is 1.9.2, matching the Iceberg XTable bundles.
1. Write a Hudi table.
pyspark \
--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"
table_path = "file:///tmp/lakehouse/trips"
trips = spark.createDataFrame(
[("trip-1001", "rider-88", 24.50, 1758000000, "sf"),
("trip-1002", "rider-12", 61.75, 1758000060, "nyc"),
("trip-1003", "rider-88", 18.20, 1758000120, "sf")],
["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("overwrite")
.save(table_path))
spark.read.format("hudi").load(table_path).show()
Leave this shell with exit() before the next step. Each format wants its own
runtime on the classpath.
2. Describe the conversion. Save as trips_sync.yaml:
sourceFormat: HUDI
targetFormats:
- ICEBERG
- DELTA
datasets:
- tableBasePath: file:///tmp/lakehouse/trips
tableName: trips
partitionSpec: city_id:VALUE
sourceFormat can be auto-detected, but the javadoc recommends setting it
explicitly, because a directory that has already been converted contains
metadata for several formats and the guess becomes ambiguous. partitionSpec is
only needed when the source table is partitioned.
3. Run it.
export XTABLE_JAR=$(ls xtable-utilities/target/xtable-utilities_*-bundled.jar)
java -jar "$XTABLE_JAR" --datasetConfig trips_sync.yaml
The first run has no earlier sync to build on, so the controller says so, once per target, and then reports the result:
INFO org.apache.xtable.conversion.ConversionController:346 - No previous InternalTable sync for target. Falling back to snapshot sync.
INFO org.apache.xtable.conversion.ConversionController:215 - Sync is successful for the following formats ICEBERG,DELTA
The formats are a comma-joined string, not a bracketed list, so match on
Sync is successful for the following formats rather than on the list. There is
a matching failure line, Sync failed for the following formats, and a run can
produce both when one target succeeds and another does not. Check for the
failure line rather than only for the success one.
The directory now holds three metadata trees beside the same Parquet files:
trips/ city_id=nyc city_id=sf .hoodie metadata _delta_log
metadata/ v1.metadata.json v2.metadata.json v3.metadata.json version-hint.text
4. Read the same directory as Iceberg.
pyspark \
--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"
spark.read.format("iceberg").load("file:///tmp/lakehouse/trips").show()
Iceberg 1.12.0 read the same table too, but it needs Java 17: on Java 11 the
session fails with UnsupportedClassVersionError ... class file version 61.0.
That is an Iceberg requirement, not an XTable one.
5. Read the same directory as Delta. On Spark 3.5 the Delta artifact is
delta-spark, which replaced delta-core from Delta 3.0. It reads the log
XTable wrote with its bundled Delta 2.4.0.
pyspark \
--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"
spark.read.format("delta").load("file:///tmp/lakehouse/trips").show()
6. Add a commit and sync again. Append more rows with the same Hudi writer
and rerun step 3. The second run does not print the fallback line, which is how
you recognise an incremental pass: the controller only speaks up when it has to
fall back. It added v4.metadata.json and a second Delta commit, and Iceberg
read the new rows. A run with no new commits at all prints nothing, not even a
success line, so an empty log is not a failed run.
Which Hudi table versions XTable reads and writes
XTable 0.5.0 bundles Hudi 1.2.1. As a source it reads table versions 6
(written by Hudi 0.14.x and 0.15.x), 8 (1.0.x) and 9 (1.1.x and 1.2.x) without
upgrading them. As a target it still writes version 6 by default. Set
xtable.hudi.target.table_version to 9 to write the Hudi 1.x timeline and the
version 2 column statistics index. Only 6 and 9 are accepted.

The two cases differ. The Hudi table the quick start wrote is a source, and its
hoodie.properties says hoodie.table.version=9. A Paimon table converted to
Hudi with the default properties is a target, and came out as
hoodie.table.version=6.
Hudi targets take three properties, set under targetProperties.HUDI in the
dataset config:
| Property | Default | Meaning |
|---|---|---|
xtable.hudi.target.table_version |
6 |
Hudi table version to write, 6 or 9 |
xtable.hudi.target.execution.engine |
java |
Engine that writes the Hudi commit and metadata table indexes, java or spark |
xtable.hudi.target.secondary.index.column |
none | Column for the secondary index. Needs version 9 and the spark engine |
Readers of a Hudi target need Hudi 0.14.0 or later for version 6 and 1.1.0 or
later for version 9, with hoodie.metadata.enable=true and
hoodie.datasource.write.hive_style_partitioning=true.
Library versions are separate from table versions. The Spark runtime jar in
0.5.0 is built against Hudi 1.2.x, so a Hudi source or target needs the 1.2.x
Spark bundle on the classpath. Hudi 1.2.x reads tables written by 0.14, 0.15 and
1.0 without upgrading them. The 0.4.0 jar fails against Hudi 0.15 or later with
NoSuchMethodError, so a cluster that has to stay on Hudi 0.14 keeps the 0.4.0
jar. A Hudi target written through the Spark runtime also needs
org.apache.hudi:hudi-java-client:1.2.1 on the classpath, or
xtable.hudi.target.execution.engine: spark. Without one of them the sync fails
with NoClassDefFoundError: org/apache/hudi/client/common/HoodieJavaEngineContext.
Copy-on-Write converts, Merge-on-Read converts as read-optimized
The project’s limitations page decides whether a Hudi table fits:
Only Copy-on-Write or Read-Optimized views of tables are currently supported. This means that only the underlying parquet files are synced but log files from Hudi and delete vectors from Delta and Iceberg are not captured by the sync.
A Merge-on-Read Hudi table converts as its read-optimized view. Everything
sitting in log files since the last compaction is not in the Iceberg or Delta
metadata XTable writes. The conversion is as of the last compaction, and a reader on the
converted side sees exactly what a read_optimized query would see. Here it is on a two-row Merge-on-Read table
where one fare was updated and not compacted:
Hudi snapshot query trip-1001 99.0 trip-1002 17.25
Hudi read_optimized query trip-1001 10.0 trip-1002 17.25
Iceberg after the sync trip-1001 10.0 trip-1002 17.25
The Iceberg copy matches the read-optimized query, and the log file holding the update sits in the partition untouched.

If the table is Copy-on-Write, this costs nothing. If it is Merge-on-Read, compaction frequency becomes the freshness bound on every converted format, which is a scheduling decision rather than a configuration one.
Two more Hudi caveats are cheap to satisfy once you know them. Set
parquet.avro.write-old-list-structure=false on the Hudi writer so list types
survive a conversion to Iceberg, and be aware that field IDs may be needed in the
Parquet schema. The Hudi metadata columns _hoodie_commit_time,
_hoodie_commit_seqno, _hoodie_record_key, _hoodie_partition_path and
_hoodie_file_name are part of the converted schema. The Iceberg schema the REST
service returned for a Hudi source listed all five, so project them away in
views if consumers should not see them.
When the cleaner outruns the target
Every format’s metadata points at the same Parquet files, so whichever format cleans files first decides what the others can still read. The sync copies metadata, not files, and it cannot protect a file from a cleaner that runs between two syncs.

Here is that failure on a Hudi copy-on-write table with the same columns as the quick start, with the cleaner set to keep one commit:
- Write commit 1, then sync to Iceberg.
- Write commits 2 and 3 with
hoodie.clean.automatic=true,hoodie.cleaner.policy=KEEP_LATEST_COMMITSandhoodie.cleaner.commits.retained=1. Each update adds a new file slice, and the cleaner deletes the oldest. A.cleaninstant appears on the Hudi timeline. - Read the Iceberg copy without syncing again. It still lists commit 1’s files, which no longer exist:
org.apache.iceberg.exceptions.NotFoundException: File does not exist ...
Caused by: java.io.FileNotFoundException: File file:/.../trips/city_id=sf/bc2bcb51-...parquet
- Sync again. The controller refuses to continue from the old position and rebuilds the target from the current source state:
INFO ConversionController:352 - Incremental sync is not safe from instant Optional[2026-12-03T13:19:22.592Z]. Falling back to snapshot sync.
The Iceberg copy then returned the latest fares for all four trips, and a repeat run gave the same result. The data was never lost: Hudi still held the current slices, and only the stale target had pointed at deleted ones.
The rule that follows is about timing, not configuration:
- Sync more often than the cleaner window. The window is the commits the cleaner retains times the commit interval. If a target can lag by more than that, readers hit missing files.
- Alert on target age against that window, not only against the sync interval.
- Expect a full pass after a long gap. A gap longer than the cleaner window means the old position is no longer safe, and the next run takes the snapshot path.
- Remember the other direction. An Iceberg source that expires snapshots or removes orphan files can delete files a Hudi or Delta target still lists. Only the Hudi cleaner case was tested.
- Time travel is bounded by the same window. A target snapshot older than the cleaner window may list files that are gone. A time-travel read after a clean was not tested.
XTable’s own housekeeping, covered in the limitations section, trims target metadata. Nothing in these runs showed it holding back the source’s cleaner.
Check the converted table
A successful log line says the metadata was written, not that it describes the same table. Compare what each format returns for the same directory. This checks row counts, schema and per-partition counts in one session that has the Hudi, Iceberg and Delta packages from the quick start on its classpath:
path = "file:///tmp/lakehouse/trips"
frames = {f: spark.read.format(f).load(path) for f in ["hudi", "iceberg", "delta"]}
for name, df in frames.items():
print(name, df.count(), sorted(c for c in df.columns if not c.startswith("_hoodie")))
per_partition = {n: sorted(df.groupBy("city_id").count().collect()) for n, df in frames.items()}
assert len({str(v) for v in per_partition.values()}) == 1, per_partition
Three habits catch most conversion problems:
- Compare against the right Hudi query. A Merge-on-Read source matches
read_optimized, not the snapshot query, as the limitations section shows. - Look at the commit history on each side.
SELECT * FROM <table>.snapshotson Iceberg andDESCRIBE HISTORYon Delta should show one entry per synced commit after an incremental run. - Re-run after every schema change that adds, drops or renames a column, and after the first compaction, because those are the points where the three formats describe the same files differently.
Failures you can hit with a Hudi source
| Symptom | Cause | Fix |
|---|---|---|
NotFoundException: File does not exist reading a converted table |
The Hudi cleaner deleted files the target still listed | Sync again, and keep the sync interval under the cleaner window |
Incremental sync is not safe from instant ... Falling back to snapshot sync |
The last synced position is no longer valid, for example after a clean | Nothing to fix. Expect a full pass and check how long it took |
| Converted table is older than the Hudi table | Merge-on-Read log files not compacted | Compact, or compare with read_optimized |
NoClassDefFoundError: org/apache/hudi/client/common/HoodieJavaEngineContext |
Hudi target in the Spark runtime, no Hudi Java client | Add hudi-java-client 1.2.1, or set xtable.hudi.target.execution.engine: spark |
NoSuchMethodError on a Hudi source with the 0.4.0 Spark runtime jar |
The 0.4.0 jar does not work with Hudi 0.15 or later |
Use the 0.5.0 jar with the Hudi 1.2.x bundle |
Key takeaways
The conversion itself is a metadata write. Whether the copies stay correct depends on Hudi’s own behaviour: the table type fixes what converts, the table version fixes what each side can read, and the cleaner fixes how long a lagging target stays valid. Check those three before the first sync, and compare counts after any change to them.
References
- Features and limitations for Hudi table versions and the target properties
- Run an XTable sync on Apache Spark for the Hudi bundle and Hudi target setup
- Apache XTable cheat sheet for the build, every flag and the troubleshooting table
- Apache XTable incremental sync for how the sync mode is chosen
- One Hudi write, two table formats for writing Iceberg metadata from the Hudi writer instead of syncing
Trademarks
Apache XTable (incubating), Apache Hudi, Apache Iceberg, Apache Spark, Apache Parquet 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.