Skip to content

Fixes #31975: deduplicate Glue columns so partition keys do not drop the whole table - #31978

Merged
mohittilala merged 5 commits into
mainfrom
fix/glue-duplicate-partition-columns
Aug 26, 2026
Merged

mohittilala merged 5 commits into
mainfrom
fix/glue-duplicate-partition-columns

Conversation

@mohittilala

@mohittilala mohittilala commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #31975

GlueSource.get_columns yielded StorageDescriptor.Columns and then PartitionKeys without deduplicating. AWS Glue does not guarantee that partition keys are absent from StorageDescriptor.Columns, so whenever the two overlap the same column was emitted twice and the server rejected the entire table with HTTP 400 Column name <name> is repeated. The table was silently never ingested while the run still reported a high success percentage.

The column iteration is now split into _iter_columns, which keeps the existing behaviour of yielding regular columns before partition keys, and get_columns, which wraps it in a single deduplication guard. Putting the guard at the wrapper means every path is covered at once: the Iceberg path, the fallback taken when GetTable fails, and the standard path. The first definition of a name wins, and each dropped duplicate is logged at debug level: source warnings are counted into the workflow summary, so warning here would report every partitioned Iceberg or Spectrum table as a problem on a run that ingested them correctly.

Deduplication keys on the emitted Column.name rather than the raw Glue name. _get_column_object truncates names to 256 characters, so two longer Glue names can collide after truncation and hit the same server-side validation. Keying on the emitted name covers that case too.

Comparison stays case sensitive so the guard cannot silently merge two distinct columns. In practice Glue lowercases column names on write, so a table declaring DT with partition key dt arrives as dt twice and is one of the shapes this fixes rather than a case the connector has to keep apart.

Type of change:

  • Bug fix

High-level design:

N/A, small change.

Tests:

Use cases covered

  • A Glue table whose partition key also appears in StorageDescriptor.Columns is ingested with that column once, instead of being rejected by the server
  • An Iceberg table registered in Glue, where the partition field is listed both in Columns and in PartitionKeys, is ingested
  • An Iceberg table whose GetTable call fails still dedupes on the fallback path
  • A normal partitioned table, where the partition key is not repeated, keeps every column
  • A table declaring DT with partition key dt, which Glue stores as dt twice, is ingested
  • Two Glue column names that collide after the 256 character truncation produce one column rather than a rejected table (deduplication keys on the emitted name, so this falls out for free)

Unit tests

  • I added unit tests for the new/changed logic.
  • Files added/updated: ingestion/tests/unit/topology/database/test_glue.py (new TestGlueColumnDeduplication, 6 cases)
  • All 6 fail on main and pass with this change. The 2 cases that guard against over-deduplication (partition_key_only, case_distinct_kept) pass both before and after.

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable. Unit coverage is sufficient because the defect is entirely in column assembly.

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

End to end against a real AWS Glue catalog and a local server on the same commit as this branch. 11 fixture tables covering all three overlap routes, the two parser failure shapes, clean partitioned controls, and clean tables sorted either side of the failing ones. The same ingestion was run twice, once with this change stashed and once with it applied.

Before After
Tables ingested 7 of 11 10 of 11
Sink errors 4 0
Sink success 73.33% 100%
Workflow exit code 1 0
Column name ... is repeated 400s 3 0

All three duplicate-column tables now ingest with each column once. Both clean partitioned controls kept every column, so the guard does not over-delete. No table in the server carries a duplicated column name afterwards.

The 11th table is unrelated: a column of Glue type struct<array> breaks ColumnTypeParser and drops the whole table on both runs. It is filed separately and untouched here.

Also run:

  1. python -m pytest ingestion/tests/unit/topology/database/test_glue.py gives 15 passed.
  2. python -m pytest ingestion/tests/unit/topology/database/ gives 1221 passed, against a 1215 baseline on main plus the 6 new tests.
  3. make py_format_check clean, and make static-checks reports no findings in either changed file.

UI screen recording / screenshots:

Not applicable.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • For JSON Schema changes: not applicable.
  • For UI changes: not applicable.
  • I have added tests and listed them above.

Bug fix

  • I have added a test that covers the exact scenario we are fixing.

Greptile Summary

The PR deduplicates AWS Glue columns after conversion to OpenMetadata column names, preventing repeated partition keys and truncated-name collisions from rejecting an entire table.

  • Splits raw Glue column iteration into _iter_columns while preserving regular-column-before-partition-key ordering.
  • Applies one deduplication guard across standard, Iceberg, and Iceberg fallback paths.
  • Adds focused tests for overlap, fallback, case sensitivity, truncation collisions, and log severity.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
ingestion/src/metadata/ingestion/source/database/glue/metadata.py Adds centralized, case-sensitive deduplication of converted Glue column names across all extraction paths.
ingestion/tests/unit/topology/database/test_glue.py Adds behavior-focused coverage for standard, Iceberg, fallback, truncation-collision, case-sensitive, and logging scenarios.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  G[Glue table metadata] --> I[_iter_columns]
  I --> R[Regular columns first]
  I --> P[Partition keys second]
  R --> D[Deduplicate emitted Column.name]
  P --> D
  D --> C[CreateTableRequest columns]
  C --> S[OpenMetadata sink]
Loading

Reviews (4): Last reviewed commit: "fix(ingestion): report a routine Glue du..." | Re-trigger Greptile

…whole table

get_columns yielded StorageDescriptor.Columns then PartitionKeys unfiltered, so an
overlapping partition key was emitted twice and the server rejected the table with
400 "Column name <name> is repeated".

Dedupe once in get_columns over a shared _iter_columns, covering the Iceberg,
Iceberg-fallback and standard paths. Keys on the emitted name so truncation
collisions are caught too.
@mohittilala mohittilala self-assigned this Aug 24, 2026
Copilot AI lite review requested due to automatic review settings August 24, 2026 15:40
@mohittilala
mohittilala requested a review from a team as a code owner August 24, 2026 15:40
@mohittilala mohittilala added the To release Will cherry-pick this PR into the release branch label Aug 24, 2026
@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Aug 24, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes Glue ingestion failures caused by duplicate partition columns by deduplicating emitted column names across all ingestion paths.

Changes:

  • Added centralized, case-sensitive deduplication, including truncation collisions.
  • Added warning logs for dropped duplicates.
  • Added six unit tests covering standard, Iceberg, fallback, and edge-case paths.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Summary
ingestion/tests/unit/topology/database/test_glue.py Adds deduplication coverage and edge-case tests.
ingestion/src/metadata/ingestion/source/database/glue/metadata.py Deduplicates emitted Glue columns across ingestion paths.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Aug 24, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit e6b3d5faaa4b5321f305a0f2869173e257d0bb02 in Playwright run 32876771984, attempt 1.

✅ 110 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky

Performance

Blocking targets: ✅ met · Optimization targets: 🟡 in progress

Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting.

🕒 Full workflow signal wall (to summary) 53m 49s

⏱️ Max setup 7m 47s · max shard execution 11m 45s · max shard-job elapsed before upload 17m 49s · reporting 3s

🌐 217.24 requests/attempt · 1.79 app boots/UI scenario · 0.00% common-shard skew

Optimization targets still in progress:

  • Browser traffic was 217.24 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 1.79 per UI scenario (216 boots / 121 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 46 0 0 0 0 0
✅ Shard ingestion-01 29 0 0 0 0 0
✅ Shard ingestion-02 35 0 0 0 0 0

📦 Download artifacts

How to debug locally
# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip    # view trace

Copilot AI review requested due to automatic review settings August 24, 2026 20:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings August 25, 2026 02:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

…warning

Source warnings are counted into the workflow summary, so warning on every repeated
partition key reported healthy Iceberg and Spectrum tables as problems on a run that
ingested every table correctly.

Say why a name can arrive twice: Glue lists a partition key in StorageDescriptor.Columns
as well as PartitionKeys, and lower cases column names on write.
Copilot AI review requested due to automatic review settings August 25, 2026 17:15
@gitar-bot

gitar-bot Bot commented Aug 25, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

Deduplicates Glue column and partition key iteration to prevent tables from being rejected by the server on duplicate column names. No issues found.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

ingestion/src/metadata/ingestion/source/database/glue/metadata.py:371

  • get_columns is a generator (it always yields) and never returns None, but the return annotation is Optional[Iterable[Column]]. This mismatched type can mislead callers/static analysis and also suggests list(columns) might be unsafe even though it always is here. Consider making the signature non-optional to reflect actual behavior.
    def get_columns(self, column_data: StorageDetails) -> Optional[Iterable[Column]]:  # noqa: UP045

@sonarqubecloud

Copy link
Copy Markdown

@mohittilala
mohittilala added this pull request to the merge queue Aug 26, 2026
Merged via the queue into main with commit 37ab26c Aug 26, 2026
122 of 125 checks passed
@mohittilala
mohittilala deleted the fix/glue-duplicate-partition-columns branch August 26, 2026 08:45
@github-actions

Copy link
Copy Markdown
Contributor

Failed to cherry-pick changes to the 2.0 branch.
Please cherry-pick the changes manually.
You can find more details here.

@github-actions

Copy link
Copy Markdown
Contributor

Failed to cherry-pick changes to the 1.13 branch.
Please cherry-pick the changes manually.
You can find more details here.

harshsoni2024 pushed a commit that referenced this pull request Aug 27, 2026
…the whole table (#31978) (#32105)

* fix(ingestion): stop a repeated Glue partition key from dropping the whole table

get_columns yielded StorageDescriptor.Columns then PartitionKeys unfiltered, so an
overlapping partition key was emitted twice and the server rejected the table with
400 "Column name <name> is repeated".

Dedupe once in get_columns over a shared _iter_columns, covering the Iceberg,
Iceberg-fallback and standard paths. Keys on the emitted name so truncation
collisions are caught too.

* fix(ingestion): satisfy basedpyright on the dynamic table_data context attribute

* fix(ingestion): report a routine Glue duplicate column at debug, not warning

Source warnings are counted into the workflow summary, so warning on every repeated
partition key reported healthy Iceberg and Spectrum tables as problems on a run that
ingested every table correctly.

Say why a name can arrive twice: Glue lists a partition key in StorageDescriptor.Columns
as well as PartitionKeys, and lower cases column names on write.
mohittilala added a commit that referenced this pull request Sep 1, 2026
…the whole table (#31978) (#32106)

* fix(ingestion): stop a repeated Glue partition key from dropping the whole table

get_columns yielded StorageDescriptor.Columns then PartitionKeys unfiltered, so an
overlapping partition key was emitted twice and the server rejected the table with
400 "Column name <name> is repeated".

Dedupe once in get_columns over a shared _iter_columns, covering the Iceberg,
Iceberg-fallback and standard paths. Keys on the emitted name so truncation
collisions are caught too.

* fix(ingestion): satisfy basedpyright on the dynamic table_data context attribute

* fix(ingestion): report a routine Glue duplicate column at debug, not warning

Source warnings are counted into the workflow summary, so warning on every repeated
partition key reported healthy Iceberg and Spectrum tables as problems on a run that
ingested every table correctly.

Say why a name can arrive twice: Glue lists a partition key in StorageDescriptor.Columns
as well as PartitionKeys, and lower cases column names on write.

This branch was previously deployed

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

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs To release Will cherry-pick this PR into the release branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Glue: tables are silently skipped when a partition key is also in StorageDescriptor.Columns

3 participants