Help Center/ AI DataLake/ devg/ Paimon Development Guide/ Paimon Development FAQs/ How Do I Achieve Data Compatibility After Schema Evolution?
Updated on 2026-11-06 GMT+08:00

How Do I Achieve Data Compatibility After Schema Evolution?

Paimon uses field IDs to ensure data compatibility after schema evolution. Each field is assigned a unique integer ID when it is created. This ID is persisted in the schema of the data file. Even if the column name or type changes, historical data files can still be correctly read using the field ID.

Important Notes

  • Uniqueness of field IDs: The ID of each field is unique throughout the table's lifecycle. After a field is deleted, its ID will not be reused. This ensures that historical data files can be correctly parsed.
  • Type change restrictions: Only upgrades from lower-precision types to higher-precision types (such as from INT to BIGINT or from FLOAT to DOUBLE) are supported. Incompatible type conversions (such as from STRING to INT) are not allowed.
  • Files written by non-Paimon engines: Data files written by other engines (such as Hive and Spark) do not contain field IDs in their schemas. When these files are read, column names are used for mapping. If column names are reused after schema evolution, it may lead to type mismatches or reading incorrect historical data.
  • Nested type evolution: For nested types such as struct, list, and map, the evolution of internal fields also follows the field ID mechanism. This ensures compatibility for historical data within nested structures.

Suggestions

  • Avoid frequent modifications to the table structure, as each schema evolution increases the complexity of metadata.
  • When deleting a column, it is recommended to use soft deletion (marking the column as unused instead of physically deleting it). This preserves the field ID for historical data backtracking.
  • For columns that require data backfilling, you are advised to use compactions to populate the new column values in newly written files. This avoids the need for a full table rewriting.