Skip to content

Support iceberg schema type change#223

Open
sfc-gh-abozkurt wants to merge 1 commit into
mainfrom
aykut/alter-iceberg-type
Open

Support iceberg schema type change#223
sfc-gh-abozkurt wants to merge 1 commit into
mainfrom
aykut/alter-iceberg-type

Conversation

@sfc-gh-abozkurt
Copy link
Copy Markdown
Collaborator

@sfc-gh-abozkurt sfc-gh-abozkurt commented Feb 23, 2026

We should support schema type evolution according to iceberg spec v2, our current iceberg implementation. This should not require data file rewrite, but metadata-only operation.

  • make sure partition values of the existing files are interpreted correctly (the same value in old type) with the new type.
  • make sure data file stats of the existing files are interpreted correctly (the same value in old type) with the new type.
  • make sure to support all catalogs: postgres, rest and object_store.
  • add spark test
  • disallow it if it specifies "SET TYPE USING (expression)" syntax as this might require data file rewrite

Closes #222.

static void AssertInternalAndExternalIcebergDataFileColumnStatsMatch(List *internalColumnStatsList,
List *externalLowerBounds,
List *externalUpperBounds);
static void NormalizeColumnBound(Field * field, unsigned char *externalValue,
Copy link
Copy Markdown
Collaborator Author

@sfc-gh-abozkurt sfc-gh-abozkurt Feb 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: we do not need these for the existing catalog values as we store them text. We can interpret them correctly when we cast their text value to new widen type.

That is only needed when we deserialize values of old type from parquet datafile or iceberg metadata.

@sfc-gh-abozkurt sfc-gh-abozkurt force-pushed the aykut/alter-iceberg-type branch 2 times, most recently from 1c4ecae to 525f874 Compare February 27, 2026 16:26
Comment thread pg_lake_table/src/ddl/alter_table.c
Comment thread pg_lake_table/src/ddl/alter_table.c
@sfc-gh-abozkurt sfc-gh-abozkurt force-pushed the aykut/alter-iceberg-type branch 4 times, most recently from 7525ac3 to a4c0a79 Compare March 3, 2026 21:12
Signed-off-by: Aykut Bozkurt <aykut.bozkurt@snowflake.com>
@sfc-gh-abozkurt sfc-gh-abozkurt force-pushed the aykut/alter-iceberg-type branch from a4c0a79 to d6610a0 Compare March 3, 2026 23:02
@sfc-gh-mslot
Copy link
Copy Markdown
Collaborator

trying to change the type to numeric(39,8) proceeds, but causes downstream failures:

SQL Compilation error: Invalid type modification for field 'B' from type '"decimal(32, 8)"'(nullability: 'true') to type '"string"'(nullability: 'true').

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support alter column set type for iceberg tables

2 participants