All posts

Apache XTable architecture: how one table speaks three formats

Read from the source code: the pipeline that turns one table's metadata into Hudi, Iceberg and Delta metadata, how sources and targets are found, what a sync calls and in what order, what XTable never guarantees, and how it compares with UniForm, Hudi's Iceberg format and in-place migration.

16 min read Lakehouse

TL;DR

XTable translates table metadata. It reads one table’s metadata in one format and writes metadata for the same data files in other formats. It does not run queries and it is not a new table format.

Everything else follows from that sentence:

  • The work is a fixed pipeline. A source reader builds an internal table model, and one writer per target format turns that model into the target’s metadata.
  • Sources and targets are found differently. Sources come from a converters config that names a class. Targets are discovered with Java’s ServiceLoader.
  • Each target is its own sync. It picks its own mode, succeeds or fails alone, and a target in the source’s own format is skipped.
  • The internal model carries schema, partition fields, files with partition values and column statistics, and the latest commit. It has no place for log files, delete files or branches.
  • Three mechanisms are easy to confuse: converting metadata, registering tables in a catalog, and letting the Hudi writer commit Iceberg metadata itself.
  • Four questions pick the tool: who writes, who reads, how fresh the copy must be, and whether you can retire a format. UniForm fits a Delta writer, Hudi’s Iceberg format fits a narrow Hudi table, and XTable covers the rest.
  • Nothing is atomic across formats. One format is the writer, and the others are projections that are as fresh as the last sync.

Teams end up with several table formats for ordinary reasons. Ingestion picked Hudi for upserts, the warehouse reads Iceberg, and a platform team standardised on Delta. Copying the data into each format costs storage, a pipeline per copy and a freshness gap between them. XTable removes the copy. The Parquet files stay where they are, and a second set of metadata describes them in another format. The 0.5.0-incubating source shows how. Each part gets its own post later in the series.

Table formats in one page

A table format is a description of which files make up a table at a point in time. The files are Parquet in every case here. What differs is the metadata and where it lives:

Format Metadata location What it records
Apache Hudi .hoodie/ A timeline of instants (commits, cleans, compactions), hoodie.properties, and a metadata table
Apache Iceberg metadata/ v<N>.metadata.json, a manifest list per snapshot, and manifests listing the data files
Delta Lake _delta_log/ Numbered JSON commits of add and remove actions, plus checkpoints
Apache Paimon snapshot/, manifest/, schema/ Snapshots and manifests over an LSM tree of files
Plain Parquet none Each file’s footer, and nothing about which files form a table

These locations are what XTable produced or read in the runs behind this series. An engine reads the format it understands, which is the whole problem: a catalog set up for Iceberg cannot read a Hudi timeline.

What XTable converts, and what it leaves alone

XTable converts the description of the table. It does not rewrite the data files. The model it builds for each file is small. In InternalDataFile and its parent, a file is a path, a size in bytes, a record count, a file format (APACHE_PARQUET by default), partition values, column statistics and a last modified time.

The internal model: an InternalTable with schema, partition fields and layout, an InternalDataFile with path, size, counts, partition values and statistics, and what it leaves out such as log files, delete files and branches

Does XTable ever open a Parquet file? Not to read rows. It reads Parquet footers in two cases. The Parquet source reads each file’s footer to get its schema, record count and statistics. The Hudi source falls back to the footer when the Hudi metadata table has missing or unusable column statistics for a file (HudiFileStatsExtractor). A secondary index build is a third case, and it reads every data file. In all other conversions, the statistics come from the source format’s own metadata.

Nothing in the model describes a Hudi log file, a delete file or deletion vector, an Iceberg branch or tag, or a Delta generated column. That is why those do not carry over. A later post in this series lists what that costs per format.

The pipeline, from source to target

One sync flows from a source table through a ConversionSource to an InternalTable, then through TableFormatSync to a ConversionTarget; targets equal to the source format are skipped

Five pieces take part in one sync. Their interfaces are in xtable-api, and the implementations are in xtable-core.

ConversionSource. One per source format. It exposes getCurrentTable(), getCurrentSnapshot(), getCommitsBacklog(...), getTableChangeForCommit(...) and isIncrementalSyncSafeFrom(Instant). The last one is what lets the controller decide between a full and an incremental pass.

InternalTable. The format-neutral description. It holds the table name, the source format, the read schema, a data layout strategy, the base path, the partition fields, the latest commit time and the latest metadata path. The layout strategy is one of HIVE_STYLE_PARTITION (folders like city_id=nyc), DIR_HIERARCHY_PARTITION_VALUES or FLAT. A partition field carries one of six transforms: YEAR, MONTH, DAY, HOUR, VALUE (identity) or BUCKET.

TableFormatSync. It runs one sync per target, in a fixed order, and returns a result per format.

ConversionTarget. One per target format. Its methods mirror what a table format needs: syncSchema, syncPartitionSpec, syncMetadata, syncFilesForSnapshot, syncFilesForDiff, beginSync, completeSync, and getTableMetadata to read back what the last sync recorded.

ConversionController. It sits above the others. It decides the mode for each target, calls TableFormatSync, and logs the outcome.

Sources and targets are found differently

A target is found by the format name. ConversionTargetFactory loads every ConversionTarget with ServiceLoader and picks the one whose getTableFormat() matches. If a target’s engine library is missing from the classpath, the loader logs a warning and skips it, and the format then fails with Target format is not yet supported. Delta has two implementations, and the factory chooses the Kernel one only when the Delta target configuration asks for it.

A source is found through the converters YAML and created by reflection, while a target is found by ServiceLoader and matched on its table format name

A source is found through configuration. RunSync reads a map of format name to provider class from xtable-conversion-defaults.yaml, merged with an optional converters config, and builds the class by reflection. The defaults map four formats:

tableFormatConverters:
    HUDI:
      conversionSourceProviderClass: org.apache.xtable.hudi.HudiConversionSourceProvider
      conversionTargetProviderClass: org.apache.xtable.hudi.HudiConversionTarget
    DELTA:
      conversionSourceProviderClass: org.apache.xtable.delta.DeltaConversionSourceProvider
      conversionTargetProviderClass: org.apache.xtable.delta.DeltaConversionTarget
    ICEBERG:
      conversionSourceProviderClass: org.apache.xtable.iceberg.IcebergConversionSourceProvider
      conversionTargetProviderClass: org.apache.xtable.iceberg.IcebergConversionTarget
    PAIMON:
      conversionSourceProviderClass: org.apache.xtable.paimon.PaimonConversionSourceProvider

Parquet is not listed, which is why RunSync rejects a Parquet source until a converters config adds it.

One sync, step by step

For each target, TableFormatSync makes the same calls in the same order:

  1. beginSync(table) opens the target’s transaction.
  2. syncMetadata(...) records the sync state. The code comment explains why it comes first: the metadata must be available before the commit.
  3. syncSchema(...) applies schema changes.
  4. syncPartitionSpec(...) applies partition changes.
  5. syncFilesForSnapshot(...) or syncFilesForDiff(...) adds and removes files, depending on the mode.
  6. completeSync() commits.

The state written in step 2 is the XTABLE_METADATA entry, holding the last synced instant, the pending instants, the source format and the source identifier. That entry is how the next run knows where to resume, and it lives in the target, not in a separate store.

The six calls TableFormatSync makes for each target: begin, sync metadata, schema, partition spec, files, complete

Each target is independent

ConversionController.syncTableFormats builds a target for every configured format except the source’s own. It then asks each target for its last recorded state and sorts the formats into two groups: those that can sync incrementally and those that need a snapshot. Both groups run in the same invocation. A source snapshot is read once and shared by every target in the snapshot group.

Each target is inside its own try block, so an exception in one becomes an error result for that format while the others continue. The log then says so:

INFO  ConversionController:215 - Sync is successful for the following formats ICEBERG,DELTA

That line is from a real run. The code logs a second message, Sync failed for the following formats <list>, at error level for the formats that failed, so a run can print both. A pipeline that greps only for the success line will miss a partial failure.

What lands on storage

One set of Parquet data files carrying a Hudi timeline, Iceberg metadata and a Delta log, each read by the engines that support that format

This is a real Hudi trips table after a sync to Iceberg and Delta, with the Hudi 1.2.1 writer on Spark 3.5:

trips/
├── .hoodie/
│   ├── hoodie.properties
│   ├── metadata/
│   └── timeline/    20261203051809787_20261203051822313.commit, .commit.requested, .inflight, history/
├── metadata/        v1.metadata.json, v2.metadata.json, v3.metadata.json, version-hint.text,
│                    snap-....avro (manifest list), ...-m0.avro (manifest)
├── _delta_log/      00000000000000000000.json, 00000000000000000000.crc
├── city_id=nyc/     the Parquet data files
└── city_id=sf/

The .hoodie/ directory is the source and was there before XTable ran. The other two are what XTable wrote. The Parquet files are shared and were not touched. A table from an Iceberg Hadoop catalog is laid out differently, with its files under data/, which is why the sync takes a separate tableDataPath.

Three mechanisms, three problems

TableFormatSync writes target metadata after the source commit, CatalogSync registers a table in Hive Metastore or Glue, and the pluggable table format makes the Hudi writer commit Iceberg metadata with each commit

TableFormatSync is what RunSync and the Spark runtime run. A source commit happens first, and a later sync writes the target metadata. Its freshness is the gap between those two.

CatalogSync is RunCatalogSync. It registers a table that already exists in a catalog. The code supports three catalog types, STORAGE, GLUE and HMS, and two clients, HMSCatalogSyncClient and GlueCatalogSyncClient. It converts nothing by itself.

The pluggable table format is the xtable-iceberg-pluggable-tf module, under xtable-hudi-support. It plugs into Hudi’s writer, so each Hudi commit also commits an Iceberg snapshot, with no sync job. It has strict requirements, covered in One Hudi write, two table formats.

What XTable guarantees, and what it does not

It guarantees that a target describes the files of the source table’s current state at the last successful sync, as far as the model can express them. It does not guarantee more than that:

  • No cross-format atomicity. The source commits first. A target appears later, and each target commits on its own.
  • No second writer. Two writers committing through different metadata trees share no concurrency control, so treat one format as the writer.
  • No retry or locking. XTable’s own code has no retry, backoff or lock. A failed result carries a canRetryOnFailure flag, and everything else is the scheduler’s job. The libraries it writes through may retry internally.
  • No feature parity. Log files, delete files, branches and generated columns do not cross.
  • No help from the engine. A reader still has to support the target format version and its catalog.
  • No protection for files. If the source deletes a file, targets that list it break until the next sync.

Where it fits

XTable earns its place when the writer and the readers want different formats and neither will move:

  • Hudi ingestion with Iceberg analytics. Upserts stay in Hudi, and the warehouse reads Iceberg.
  • A multi-engine platform. One table is readable by engines that support different formats, without a copy per engine.
  • Several catalogs. The same tables registered in Hive Metastore and Glue for different teams.
  • Evaluating a migration. Expose a table as Iceberg or Delta to test consumers before rewriting anything.

It is the wrong tool when one engine reads and writes the table, when the table depends on features that do not convert, or when readers need the metadata at the moment of the write. The next section compares it with the alternatives.

Choosing between XTable and its alternatives

The question that starts most of these conversations is “can engine B read my table?”. It has a different answer depending on who writes the table and how quickly engine B must see a change. XTable’s own behaviour comes from the 0.5.0-incubating source. The other tools are described from their documentation, and each such statement says so.

The four questions

  1. Who writes the table? One writer, in one format. Two writers in different formats is a different problem that none of these tools solves.
  2. Who reads it? Name the engines and the formats they support. If one format covers all of them, stop here.
  3. How fresh must the second format be? Seconds, minutes, or at the next batch.
  4. Can you retire a format? A one-way move is simpler than keeping two in step, if the business allows it.

The options

Option What it does When the other format updates Restrictions
XTable Writes the target format’s metadata over the same files After the source commit, on each sync Metadata only. Merge-on-Read logs and delete files do not convert
Delta UniForm A Delta table generates Iceberg, and Hudi in preview, metadata Asynchronously after each Delta write Delta is the writer. Readers of the other format cannot write
Hudi’s Iceberg table format The Hudi writer commits an Iceberg snapshot with each Hudi commit In the same commit Copy-on-Write, identity partitioning, metadata table off, one writer
Iceberg in-place migration Turns an existing table into an Iceberg table, or shares its files Not applicable, it is a one-time move Iceberg’s procedures document Hive and Spark tables as sources
Catalog sync tools Register the table in a catalog Not applicable They do not convert a format

XTable

The writer commits as it always does. XTable then reads that table’s metadata through a ConversionSource, builds an InternalTable, and a ConversionTarget writes the other format’s metadata. Each target is a separate sync with its own result, the sync state is stored in the target, and the next run resumes from it. The sections above walk through the code. What it gives you is breadth: sources are Hudi, Iceberg, Delta, Paimon and Parquet, and targets are Hudi, Iceberg and Delta. What it costs is a job to run and a lag. The lag is the time from your commit to the next successful sync.

When the second format updates: XTable after the next sync, UniForm shortly after each write, Hudi's Iceberg format in the same commit, migration once

Hudi’s Iceberg table format

This is the xtable-iceberg-pluggable-tf module. It registers an IcebergTableFormat with Hudi through ServiceLoader, so the Hudi writer itself commits an Iceberg snapshot with each commit and no sync job exists. The restrictions are enforced in the code, and each one throws UnsupportedOperationException:

  • the table must be copy-on-write: “The Iceberg table format only supports COPY_ON_WRITE tables”;
  • partitioning must be identity: a timestamp-based key generator, or a custom key generator field whose type is not the simple one, is rejected with “only supports identity partitioning”;
  • the Hudi metadata table must be off, with a message telling you to set hoodie.metadata.enable=false on every writer;
  • restoring the table is refused.

One Hudi write, two table formats covers it in depth. It is the right choice when Hudi is the writer, the table fits those limits, and Iceberg readers must never lag.

Delta UniForm

From the Delta documentation: a Delta table can enable Iceberg, Hudi, or both through delta.universalFormat.enabledFormats. Metadata generation starts asynchronously after a Delta write completes, Iceberg and Hudi clients can read the result but not write to it, Hudi support is a preview that needs Delta 3.2 or later, and column mapping must be enabled. This was not run for this series. It is Delta-only by construction, which is the reason to pick XTable when the writer is Hudi or Iceberg.

Iceberg in-place migration

The Iceberg Spark procedures include migrate, which replaces a Hive or Spark table with an Iceberg table using the existing data files and does not keep the original unless you ask for a backup, and snapshot, which creates a new Iceberg table that shares the source’s files and is meant for trying a migration before committing to it. add_files adds existing files to an Iceberg table. The documentation names Hive and Spark tables as the sources. Whether they accept a Hudi or Delta table as the source was not confirmed here, so check before you plan around it. This path is one-way: afterwards the table is Iceberg and the old format’s writers no longer own it.

Catalog sync tools

Hudi ships tools that register a Hudi table in a catalog such as Hive Metastore or Glue, and XTable has its own RunCatalogSync, whose supported catalog types in 0.5.0 are STORAGE, GLUE and HMS. Neither writes metadata in another table format. They answer “where is the table?”, not “how does Iceberg read it?”. The Hudi tools are described from Hudi’s documentation, not from code read here.

Which one to use

A decision flow: if every reader can use one format, move to it; if Delta is the only writer, check UniForm; if the writer is Hudi copy-on-write with identity partitions and only Iceberg readers, use Hudi's Iceberg format; otherwise use XTable

Walk the chain from the left, and stop at the first yes. XTable is where you land when none of the narrower options fits, which is common. A merge-on-read Hudi table, an Iceberg writer with Delta readers, or two target formats at once all end up there.

Where each one fails

  • XTable: the target lags, the source’s cleaner can delete files a target still lists, and nothing in XTable retries or locks. Plan for that in the scheduler.
  • Hudi’s Iceberg format: a writer without the module on its classpath can fall back to native Hudi behaviour and write no Iceberg snapshot, so every job that touches the table needs the JARs.
  • UniForm: an asynchronous metadata step means a reader can see an older snapshot than the one just written.
  • Migration: the old format’s pipelines break the day after, because the table is no longer theirs.

Checked against the source

Everything above was read from the 0.5.0-incubating tag:

Claim Where
Interfaces of source, target and the sync calls xtable-api: ConversionSource, ConversionTarget, TableFormatSync
Call order inside one target’s sync TableFormatSync.getSyncResult
Per-target modes, skipping the source format, partial failure ConversionController.syncTableFormats
Targets from ServiceLoader, Kernel selection ConversionTargetFactory.createConversionTargetForName
Sources from the converters config by reflection RunSync.getConversionSourceProvider and xtable-conversion-defaults.yaml
The model: files, partition transforms, layout strategies InternalTable, InternalDataFile, PartitionTransformType, DataLayoutStrategy
Parquet footer reads parquet/ package and HudiFileStatsExtractor
Catalog types and clients CatalogType, HMSCatalogSyncClient, GlueCatalogSyncClient
Pluggable Iceberg format registers through ServiceLoader META-INF/services/org.apache.hudi.common.HoodieTableFormat, IcebergTableFormat
Copy-on-Write, identity partitioning and metadata table restrictions, restore refused IcebergTableFormat.requireCopyOnWrite, requireMetadataTableDisabled, IcebergActiveTimeline.restoreNotSupported

The storage layout and log lines are from runs on Spark 3.5.9 with the Hudi 1.2.1 writer. UniForm and the Iceberg procedures come from their documentation, linked below, and were not run. The Hudi catalog tools were not checked.

Key takeaways

XTable is a small, fixed pipeline. A reader builds a neutral model, and a writer per target format turns it into metadata, one target at a time, each with its own mode and its own result. That simplicity sets the limits: whatever the model cannot express does not convert, and nothing in the pipeline coordinates writers, retries failures or protects files from the source’s cleaner. The rest of the series covers each of those in turn.

References

Trademarks

Apache XTable (incubating), Apache Hudi, Apache Iceberg, Apache Paimon, Apache Parquet, 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.

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.