CLOUD CONCEPT

Schema Evolution

Schema evolution is the controlled modification of data structures over time while managing compatibility between existing data, producers, and consumers.

Cloud Concepts Hub →

What is Schema Evolution

Data schemas change as applications add fields, revise types, restructure records, or integrate new sources. Schema evolution defines how those changes are introduced, validated, and interpreted so that ingestion pipelines, transformations, tables, and downstream applications continue to work correctly.

Schema evolution treats a schema as a versioned contract rather than a permanent description of data. The contract includes field names, types, nullability, nested structures, and sometimes defaults or identifiers. A change must be evaluated against both stored records and running applications: accepting a new record does not necessarily mean that an older transformation or dashboard can interpret it correctly.

Compatibility has a direction. Backward compatibility means that a new reader schema can read data written with an older schema. Forward compatibility means that an older reader schema can read data written with a newer schema. Full compatibility requires both. The exact rules depend on the serialization format, table format, and reader implementation. Adding an optional field is often compatible, but required fields, default values, unknown-field handling, and type conversions must be checked. Transitive compatibility checks extend beyond the immediately preceding version to earlier registered versions.

When integrating multiple sources, first establish a canonical schema and explicit mappings. For example, one customer source might send customer_id as an integer while another sends alphanumeric identifiers as strings. Converting both to a sufficiently capable string representation can preserve values, but blindly casting the second source to an integer can fail or discard information. Similarly, timestamps require agreement about time zones and precision, and monetary values require consistent currency and decimal scale. Structural compatibility alone does not guarantee semantic compatibility.

A practical rollout might add a nullable loyalty_tier field to an orders dataset. Update the destination and readers to tolerate the field before producers begin populating it. Historical records can remain without the value if readers correctly interpret its absence; backfill them only when business requirements demand it. A rename requires more care because a name-based system may interpret it as removing one field and adding another. A staged transition can publish both names temporarily, update consumers, and retire the old name after dependencies have migrated.

Open table formats such as Apache Iceberg make schema changes explicit table metadata operations. Iceberg tracks columns using stable field identifiers, allowing supported renames and reordering without confusing one column with another. Supported additions, deletions, and type promotions can generally occur without rewriting existing data files. However, arbitrary type changes are not safe promotions, and metadata-only changes do not convert historical values or update application code. Supported operations also depend on the engine and connector. Partition evolution is a separate capability and should not be confused with changing a table's column schema.

In a cloud data lake, distinguish the physical file schema, the catalog schema, and the schema expected by each processing job. Updating a catalog does not rewrite Parquet files or repair incompatible partitions. AWS Glue crawlers can discover schemas and populate the AWS Glue Data Catalog, but discovery is not a compatibility guarantee. Configure crawler grouping and schema-change behavior deliberately; for controlled datasets, consider logging detected changes instead of automatically replacing production definitions. Validate inferred types against representative files, especially when fields are sparse or vary between source versions.

When transformations fail, compare the incoming records, file metadata, catalog definitions, and job schema. Common causes include strings appearing in numeric fields, nested objects replacing scalar values, missing required fields, incompatible partition schemas, and casts that overflow. Preserve failing records in a quarantine location with diagnostic information rather than silently converting every error to null. Test old and new records together, monitor rejected-record and unexpected-null counts, and distinguish genuine schema changes from malformed data.

Automatic schema merging reduces manual work but can increase planning time and metadata reads across many files. Repeated inference, unnecessary casts, and mixed physical types can also increase processing cost or prevent efficient reads. Prefer explicit schemas for stable production interfaces and use discovery to detect drift. Schema-on-read does not eliminate evolution work: it moves compatibility decisions to readers. A reliable approach combines versioned contracts, compatibility tests, controlled catalog updates, staged deployments, and backfills only when required.

Key aspects of Schema Evolution

Reliable schema evolution combines compatibility rules, explicit mappings, coordinated deployments, metadata discipline, and validation of both historical and incoming data.

Directional compatibility

Evaluate whether new readers can consume old data and whether old readers can consume new data. Apply the actual rules of the serialization format and processing engine rather than assuming every additive change is safe.

Explicit source-to-target mapping

Normalize field names, types, units, timestamp conventions, and null handling when combining sources. Preserve business meaning as well as structural validity.

Controlled change rollout

Version contracts and coordinate producer, reader, and destination updates. Use staged transitions for breaking changes, and test against historical records and consumers that have not yet upgraded.

Separation of metadata and stored data

A catalog update changes the published description of data, not necessarily the data itself. Determine whether each change needs only metadata updates, reader changes, a backfill, or a physical rewrite.

Table-format-aware evolution

Use supported table-format operations for additions, renames, deletions, and type promotions. Stable field identifiers in formats such as Iceberg help preserve column identity, but engine support and downstream dependencies still require validation.

Drift detection and failure isolation

Compare observed schemas with approved contracts and alert on unexpected differences. Quarantine invalid records and monitor conversion failures so that permissive processing does not silently corrupt the dataset.

Cloud services for Schema Evolution

A streaming application can publish to Amazon MSK using serializers integrated with AWS Glue Schema Registry, providing versioned event contracts and compatibility checks. AWS Glue or Amazon EMR can then normalize incoming records and write curated tables, including Iceberg tables where supported. The AWS Glue Data Catalog supplies table metadata, while crawlers can discover changes subject to configured update policies. Amazon Athena consumes the curated tables for SQL analysis. Keep these responsibilities separate: a registry governs event contracts, a catalog describes datasets, processing jobs transform values, and a table format manages table metadata. Changes must be tested across the entire path rather than treated as complete when one schema definition is updated.

AWS Glue image AWS Glue

AWS Glue crawlers discover schemas and populate the AWS Glue Data Catalog, while ETL jobs can explicitly map and convert changing source structures. AWS Glue Schema Registry versions supported event schemas and applies configured compatibility checks; its contract-validation role is distinct from catalog discovery.

Open AWS Glue →
Amazon Athena image Amazon Athena

Athena queries datasets using catalog and table metadata, making mismatches between declared schemas and underlying files operationally important. Its supported Iceberg DDL operations provide controlled table schema changes, but do not automatically update downstream SQL or business logic.

Open Amazon Athena →
Amazon EMR image Amazon EMR

Amazon EMR runs processing engines such as Apache Spark that can reconcile source schemas, apply explicit conversions, and work with open table formats such as Iceberg. Supported evolution behavior depends on the selected EMR release, engine, and table-format configuration.

Open Amazon EMR →
Amazon Managed Streaming for Apache Kafka image Amazon Managed Streaming for Apache Kafka

Amazon MSK supports streaming pipelines whose producers and consumers may run different schema versions simultaneously. Applications can integrate AWS Glue Schema Registry through compatible serializers and deserializers; Kafka brokers themselves do not enforce application-level schema compatibility.

Open Amazon Managed Streaming for Apache Kafka →