Skip to main content

Schema Evolution and Data Type Changes

This document explains how OLake Go handles schema changes and data type changes in your data pipelines. It covers two distinct features that help maintain pipeline resilience when your source data structures evolve.

Schema Evolution​

Schema evolution refers to changes in your database structure like adding, removing, or renaming columns and tables. OLake Go handles these changes to prevent pipeline failures and data loss.

Schema Evolution — Column-Level Changes​

Change TypeHow OLake Go Detects & Handles ItTypical Pipeline ImpactExtra Details & Tips
Adding a columnWhen records with a new source column arrive, OLake Go adds the column to the Iceberg schema (new field ID) and starts writing its values, as long as Sync new columns automatically is on. Since OLake Go v0.10.1, a sync does not re-run schema discovery unless it runs with --discover-schema, which OLake UI does not pass. Discovery runs when you open Edit Streams in OLake UI or run discover. If the source back-fills historical rows, CDC registers them as updates. No user action required.No breakage. Historical rows show NULL until back-filled.• Monitor write throughput if a back-fill is large.
Deleting a columnWhen a source column is dropped, new rows no longer carry it, so OLake Go writes null for it.
The column stays in the Iceberg schema, so old snapshots remain queryable.
The next discover (Edit Streams in OLake UI, or discover) removes it from the stream's column list.
No breakage. ETL continues with a "virtual" column (null-filled).• BI tools won't break, but may show the column full of nulls, communicate schema changes.
• Run a rewrite manifests job later to drop the dead column if storage footprint matters.
Renaming a columnA rename shows up in the incoming records as a new column name.

When a source column is renamed, OLake Go interprets this as:
→ The old column remains in the destination (but no new values are written).
→ A new column with the updated name is added and starts receiving incoming data.

WIP: Because Iceberg keeps immutable field IDs, OLake Go can also just update the column's name on the same field ID (e.g., customer_id → client_id): avoiding data migration entirely.
No breakage.• Renames are instant, no file rewrites.
• Update SQL queries downstream to use the new column name.
JSON / Semi-structured key add / remove / renameOLake Go flattens keys to a canonical path inside a single JSON column (or keeps raw JSON).
• Added keys appear automatically.
• Removed keys vanish from new rows.
• Renamed keys are treated as "remove + add" because JSON has no intrinsic field ID.
No breakage.
info
  • A sparse new column is not synced to the destination until at least one row has a non NULL value. Iceberg stores data column-wise in Parquet, so empty columns are omitted.

Schema Evolution — Table-Level Changes​

Change TypeHow OLake Go Detects & Handles ItTypical Pipeline ImpactExtra Details & Tips
Adding a tableNewly detected source tables appear in the OLake UI list. You choose which ones to sync. Once added, OLake Go applies whichever sync mode you've configured. Tables not selected to sync are ignored.No breakage. Pipelines for existing tables run as usual; disabled tables simply do not sync.Initial full loads run in parallel.
Deleting a tableNo new data will get added to the deleted table. Existing table data and metadata remain queryable.No breakage. Downstream queries on historic data still work; new inserts stop.If the table is recreated later with the same name but different structure, treat it as a brand-new stream to avoid field-ID collisions.
Renaming a tableWhen a source table is renamed, OLake Go treats it as a new table. It is discovered as a new stream in schema discovery. Once you enable sync for this table, OLake Go applies the configured sync mode.

• The old Iceberg table keeps historical data.
No breakage, but post-rename data lands in a separate table unless you merge histories.For continuous history, enable the new table quickly and (optionally) set an alias so both names map to the same Iceberg table.

Schema Data Type Changes​

Schema data type changes refer to modifications to the data type of existing columns (e.g., changing INT to BIGINT). OLake Go leverages Apache Iceberg v2 tables' type promotion capabilities to handle compatible changes automatically.

Supported Data Type Promotions​

OLake Go supports Iceberg v2's widening promotions, where the destination column type expands to accommodate a larger range or higher precision without data loss. These include:

FromToNotes
INTLONG (BIGINT)Widening integers is safe
FLOATDOUBLEPromoting to higher precision works without data loss
DECIMAL(P, S)DECIMAL(P', S) where P' > POnly widening precision is supported

OLake Go writes source DATE columns as Iceberg timestamptz, so a source change from DATE to TIMESTAMP lands in the same column type and needs no promotion. Iceberg's own date to timestamp promotion exists only in table format version 3 (Iceberg spec, schema evolution).

info

Writing an INT value into a FLOAT or DOUBLE column is supported in Iceberg, as it is considered a safe numeric conversion rather than a schema change.

Similarly, writing a BIGINT value into a DOUBLE is also supported.

caution
  • Iceberg v2 supports widening type changes only. Narrowing changes (e.g., BIGINT to INT) along with any other data type changes will result in an errror as are not supported.
  • Parquet files are immutable. Existing files cannot be modified in place, so in-place data type changes and schema evolution at the file level are not supported.

Handling Incompatible Data Type Changes​

For data type changes not supported by Iceberg v2:

  1. (INT, LONG, FLOAT, DOUBLE) ➡ STRING - OLake Go provides enhanced type conversion handling. At the destination if the data type is string, and incoming values are numeric, then the values are converted and stored as string.

  2. Narrowing Type Conversions like:

    • BIGINT to INT
    • DOUBLE to FLOAT

    When a source value's data type has a smaller range or precision than the destination column's type, OLake Go treats this as a narrowing conversion and handles it seamlessly. For example, if the destination column is defined as BIGINT but the incoming values are INT, OLake Go recognizes that every INT value falls within BIGINT's range and simply stores the values without error. This validation step ensures that compatible, smaller-range types are accepted even when Iceberg v2 would flag a mismatch.

tip

Any other incompatible data type change fails the sync, as listed under Unsupported Data Type Conversions. A Dead Letter Queue (DLQ) column that would keep these values is on the OLake Go roadmap and is not available yet.

Unsupported Data Type Conversions​

The data type changes listed below are unsupported in Iceberg v2 and OLake Go. Attempting these will result in sync failure.

  1. Attempting to write a FLOAT value into an INT column.
  2. Attempting to write a STRING value into INT/DOUBLE/LONG/FLOAT column.

Decimal Columns​

For jobs created on OLake Go v1.2.0 and above, decimal source columns land as a decimal type. Float, double and real columns keep their float types, and integer columns keep integer types. In Oracle, NUMBER(p,0) counts as an integer column and lands as int or bigint.

Which source types land as decimals is listed in each source's Data Type Mapping, such as Postgres and MySQL.

Decimal behaviour
  • Exact values: a value with more digits than its column's precision or scale fails the sync with an error rather than being rounded.
  • NaN: Postgres NUMERIC(p,s) can hold NaN, which no decimal can. A NaN is written as null, and the sync logs one warning for it.
OLake Go TypeIceberg Type
decimal(p,s), p up to 38decimal(p, s)

Iceberg promotes decimal(P,S) only to decimal(P',S) with P' > P, so the same scale and more digits. A precision widening such as DECIMAL(18,4) to DECIMAL(20,4) evolves in place, partition columns included. Any other change fails the stream: a new scale, a change to unconstrained NUMERIC, or more than 38 digits.

The error reads:

failed to validate schema for field[b] (detected two different types in batch), expected type: decimal(9, 4), detected type: decimal(12, 6)

Run Clear Destination to recreate the table, as for any other type Iceberg cannot widen.

Example Scenarios​

Scenario 1: Adding a Column in Source​

When a new column appears in your source data:

  • OLake Go automatically detects the new column
  • New columns are synced automatically only when Sync new columns automatically is enabled. If not user has to manually select those columns to be included in the sync
  • The column is added to your destination schema
  • New data includes values for this column
  • Historical data has null values for this column

Scenario 2: Adding a Table / Collection in Source​

When a new table appears in your source database:

  • The new table appears in the Streams list the next time you open Edit Streams in OLake UI (which runs discover) or run discover. Scheduled syncs do not discover new tables
  • The table is synced only when you explicitly enable it for the job
  • Once enabled, OLake Go creates the destination table and starts syncing using your configured sync mode

Scenario 3: Table Name Change​

When a table name changes in your source database:

  • The renamed table appears as a new stream the next time discover runs (Edit Streams in OLake UI, or discover)
  • The table is added to your destination schema
  • A New table gets created
  • The old table name is retained in the destination schema but will not be populated with new data

Scenario 4: Widening Type Conversion​

The following conversions are handled:

  • INT → BIGINT
  • FLOAT → DOUBLE

When a column data type is INT and it encounters BIGINT type or when a FLOAT column encounters a DOUBLE type:

  • OLake Go detects the widening type change
  • Column type is updated in the destination
  • All values are properly converted
  • Pipeline continues without interruption

Scenario 5: Narrowing Type Conversion (BIGINT to INT Conversion)​

The following conversions are handled:

  • BIGINT → INT
  • DOUBLE → FLOAT

When a column data type is BIGINT and it encounters INT type or when a DOUBLE column encounters a FLOAT type:

  • OLake Go detects the narrowing type change
  • Column type is validated in the destination making sure it fits in the target type's range
  • All values are properly approved
  • Pipeline continues without interruption

Scenario 6: Incompatible Type Change​

The following conversions are handled:

  • INT → STRING
  • BIGINT → STRING
  • FLOAT → STRING
  • DOUBLE → STRING

When a column data type is STRING and it encounters NUMERIC type:

  • OLake Go detects the incompatible type change
  • Numeric values are converted to their string representation
  • Converted values are stored as strings in the destination
  • Pipeline continues without interruption

Scenario 7: Unsupported Type Change​

When the column data type is INT and it encounters FLOAT or when a NUMERIC column encounters a STRING type:

  • OLake Go detects the type mismatch
  • The write is not allowed and the sync fails

For more detailed information on Iceberg's schema evolution capabilities, refer to the Apache Iceberg documentation.