Skip to content

fix(glue): Exclude historical schemas from Glue columns - #3390

Open
VABVAT wants to merge 3 commits into
apache:mainfrom
VABVAT:fx/glue_duplicate_columns
Open

VABVAT wants to merge 3 commits into
apache:mainfrom
VABVAT:fx/glue_duplicate_columns

Conversation

@VABVAT

@VABVAT VABVAT commented Oct 10, 2026

Copy link
Copy Markdown

Which issue does this PR close?

What changes are included in this PR?

This PR updates Glue schema conversion so AWS Glue StorageDescriptor.columns is populated only from the current Iceberg schema.

Previously, GlueSchemaBuilder::from_iceberg converted the current schema and then also converted historical schemas from table metadata. Those historical fields were written to Glue with iceberg.field.current=false, but Glue does not use that parameter to filter visible columns, which could cause duplicate columns to appear in the Glue Console after schema evolution.

Historical schemas are still preserved in Iceberg table metadata. This change only prevents them from being projected into Glue's visible column list.

Are these changes tested?

Yes.

Added a regression test covering schema evolution with historical schemas, and verified the Glue schema output contains only current schema fields.

Ran locally:

cargo test -p iceberg-catalog-glue

Copilot AI balanced review requested due to automatic review settings October 10, 2026 06:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@David-Banquet

Copy link
Copy Markdown

Thanks for picking this up again.

This drops the older schemas entirely, so columns removed from the table also disappear from Glue. The Java catalog keeps them: toColumns in IcebergToGlueConverter writes the current schema first, then the older schemas with iceberg.field.current=false, and skips any name it has already added. The duplicates come from that missing name check, so keeping the loop and adding a HashSet of top-level names already written would fix #2749 and keep the Glue output the same as Java's. A table written by both Spark and iceberg-rust would otherwise see its Glue columns change depending on which engine committed last.

If the maintainers prefer current-schema-only, that's a fair choice too, but it's a behavior change from Java and probably worth saying so in the PR description.

Two smaller things:

  • The new test only adds a column, where both approaches give the same result. A case that drops a column (and one where a field keeps its name across schemas with a different type) would show which behavior is intended.
  • builder.is_current = false; and its comment can go: the fields are private and nothing reads them after from_iceberg returns.

This branch has not been deployed

No deployments
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.

iceberg-catalog-glue pushes all historical schema fields to Glue, causing duplicate columns in Glue UI

3 participants