Skip to content

fix(glue): keep column lineage when storage displayName is null, iceberg partition key - #34194

Merged
harshsoni2024 merged 5 commits into
mainfrom
fix/glue-lineage-display-name-and-iceberg-partition-keys
Sep 30, 2026
Merged

harshsoni2024 merged 5 commits into
mainfrom
fix/glue-lineage-display-name-and-iceberg-partition-keys

Conversation

@harshsoni2024

@harshsoni2024 harshsoni2024 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes open-metadata/openmetadata-collate#5947
Fixes open-metadata/openmetadata-collate#5949

Two Glue fixes from the 2.1 epic. They are bundled because both are small, both are in Glue's column path, and both are tested in test_glue.py.

#5947: column lineage to a storage container is dropped when a storage column has no displayName.

ExternalTableLineageMixin._get_data_model_column_fqn called entity_column.displayName.lower() with no null check. _get_column_lineage wrapped the whole loop in one try, and its except returned None.

The null is routine. StorageServiceSource._partition_columns_to_table_columns builds partition columns without a displayName, and _get_columns lists them first (partition_cols + extracted_cols). So on any partitioned container the first comparison raised, and the edge went out with columnsLineage=None, meaning table-level lineage only. The server never fills in a column displayName either, and ColumnRepository sets it to null when a user clears it.

  • Match on displayName, and on the column name when displayName is unset. Matching stays case-insensitive. displayName is still checked first, so every match that works today still works.
  • A matched column with no FQN resolves to nothing instead of raising on .root.
  • Each column resolves in its own try, so a failure costs only that column's edge, and the function always returns a list.

The mixin is shared, so the Athena, Databricks, Unity Catalog metadata, Snowflake and Redshift sources get the same fix. It is generic null-safety, not connector-specific behaviour.

#5949: _iter_columns read iceberg.field.current from PartitionKeys.

Nothing can produce that data:

  • Glue rejects parameters on partition columns ("Parameters not supported for partition columns").
  • Apache Iceberg's IcebergToGlueConverter, the only writer of the flag, sets it on StorageDescriptor.Columns and never sets PartitionKeys at all. Every field, partition sources included, is written to StorageDescriptor.Columns, and that is where a retired field is flagged.
  • Athena's own Iceberg block (athena/utils.py) already reads the flag from StorageDescriptor.Columns only.

The retired-field filter now runs over regular columns only, and partition keys are always emitted. test_retired_partition_key_is_dropped is replaced, because its payload is one Glue refuses. This removes the branch #33850 carried over from the old get_table path.

Type of change:

  • Bug fix

High-level design:

N/A, small change (4 files). The one cross-cutting point is covered above: the #5947 fix lives in the shared ExternalTableLineageMixin. The blast-radius run below shows no behaviour change for the mixin's other users.

Tests:

Use cases covered

  • A partitioned container whose partition column has no displayName gets column edges for the partition column and the regular column. Before, it got neither.
  • The name fallback is case-insensitive (Region in storage matches region in Glue).
  • A container column with no FQN, and a table column the container lacks, each lose only their own edge.
  • An error while resolving one column leaves the other edges in place.
  • End to end through GlueSource: yield_table on a partitioned table with an s3a:// location fills the location map. yield_external_table_lineage then emits a container→table edge whose column lineage includes the partition key.
  • An Iceberg table keeps its partition keys, and a retired regular column is still dropped.

Unit tests

  • I added unit tests for the new/changed logic.
  • Files updated: ingestion/tests/unit/topology/database/test_glue.py
    • New TestGlueExternalTableColumnLineage (5 tests). Each test asserts the AddLineageRequest the source emits, not the helper's return value. Only the two ES lookups (es_search_container_by_path, es_search_from_fqn) are stubbed.
    • In TestGlueIcebergRetiredColumns, test_retired_partition_key_is_dropped is replaced by test_partition_keys_of_an_iceberg_table_are_kept. The test helper now builds partition keys as Glue returns them, with no Parameters.
  • RED/GREEN: all 5 lineage tests fail on main, where the edge is emitted with empty column lineage, and pass with the fix. The [Snyk] Security upgrade moment from 2.29.1 to 2.29.4 #5949 test passes on both. That is expected, since the removed branch had no observable effect on any payload Glue accepts.
  • Coverage (pytest-cov over test_glue.py): external_table_lineage_mixin.py 92%, glue/metadata.py 87%. Every changed line is covered. The mixin's remaining misses (lines 89-91, 98) are lines this PR does not touch.
  • test_glue.py: 113 passed, 2 failed. The 2 failures reproduce identically on main: GlueUnitTest::test_database_schema_names and …_filters_other_catalogs_before_schema_filter. They come from an existing order dependency. _custom_db_name_source (added in fix(glue): stop a custom databaseName dropping every schema #31958) leaves database=NEW_DB in the process-wide topology context. Both tests pass in isolation.
  • Blast radius of the mixin change: I ran the Glue, Athena, Databricks, Unity Catalog, Snowflake, Redshift and sql_lineage suites on main and on this branch. The failure and error sets are identical, and all come from optional connector dependencies that are missing locally. Passes went from 336 to 340. With pyathena installed, test_athena.py and test_athena_utils.py pass 60/60 on both, including test_column_lineage, which calls _get_column_lineage directly.
  • Lint: ruff check, ruff format --check and check_ruff_suppressions.py --check are clean. One G004 baseline entry is pruned, because the rewritten logger call now uses lazy formatting. basedpyright, scoped to src as in CI, reports 0 errors on the changed files.

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • Not applicable. The change is in how Glue columns and container columns are matched from API payloads, and the unit tests drive that through the real GlueSource and the real pydantic models. An integration test would need a live Glue catalog and an S3 storage service, which CI does not have.

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

No live AWS run. The end-to-end path through the real GlueSource.yield_table and yield_external_table_lineage was exercised with only the two ES lookups stubbed (test_a_partitioned_glue_table_gets_an_edge_for_its_partition_key):

  1. A partitioned Glue table (event_id, partition key dt, location s3a://bucket/events) goes through yield_table.
  2. The container search returns a data model whose partition column dt has no displayName.
  3. Before the fix: one container→table edge with empty columnsLineage. After: the same edge carrying dt → dt and event_id → event_id.

UI screen recording / screenshots:

Not applicable.

Checklist:

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

… unreachable Iceberg partition-key filter

Fixes open-metadata/openmetadata-collate#5947
Fixes open-metadata/openmetadata-collate#5949

External-table lineage matched storage columns on displayName alone. Storage
connectors list partition columns first and leave their displayName unset, so
the first comparison raised and the loop-wide except dropped every column
edge, keeping only the table-level one. Match on displayName or, when it is
unset, the column name; resolve a matched column without an FQN to nothing;
and resolve each column in its own try so a failure costs only its own edge.
The mixin is shared, so the Athena, Databricks, Unity Catalog metadata,
Snowflake and Redshift sources get the same fix.

Glue rejects parameters on partition keys, and Iceberg's Glue catalog writes
iceberg.field.current only on StorageDescriptor.Columns, so the retired-field
check on PartitionKeys could never fire. Apply it to regular columns only and
always emit partition keys.
Copilot AI balanced review requested due to automatic review settings September 29, 2026 05:58
@harshsoni2024
harshsoni2024 requested a review from a team as a code owner September 29, 2026 05:58

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.

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

@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Sep 29, 2026
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

✅ Playwright Results — workflow succeeded

Validated commit e569f424e370fe394a9dc66c8086d89516db75b3 in Playwright run 36680030533, attempt 1.

✅ 105 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) 49m 0s

⏱️ Max setup 5m 16s · max shard execution 14m 56s · max shard-job elapsed before upload 20m 31s · reporting 4s

🌐 252.38 requests/attempt · 1.82 app boots/UI scenario · 0.00% common-shard skew

Optimization targets still in progress:

  • Browser traffic was 252.38 requests per attempt (convergence target: fewer than 200).
  • Application boot ratio was 1.82 per UI scenario (207 boots / 114 scenarios; convergence target: at most 1).
Shard Passed Failed Flaky Skipped Lifecycle failed Lifecycle flaky
✅ Shard chromium-01 40 0 0 0 0 0
✅ Shard ingestion-01 24 0 0 0 0 0
✅ Shard ingestion-02 41 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 September 29, 2026 10:54

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.

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

Copilot AI review requested due to automatic review settings September 29, 2026 17:01

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.

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

Copilot AI balanced review requested due to automatic review settings September 30, 2026 06:45

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.

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

@gitar-bot

gitar-bot Bot commented Sep 30, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Shared lineage matching changes behavior across multiple ingestion connectors.

Fixes column lineage loss when storage displayName is null by matching on column name as fallback, and removes unreachable Iceberg partition-key filter that read from PartitionKeys instead of StorageDescriptor.Columns. Comprehensive unit tests cover the null-safety fix across partitioned containers and demonstrate the column lineage is now preserved. No issues found.

Review coverage

📋 Rules No rules evaluated

🧪 Functional validation Not enabled · Set up

🤖 Auto-approval Not enabled · Set up

Options

Display: compact → Counting what did not apply, without listing it.

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

@sonarqubecloud

Copy link
Copy Markdown

@harshsoni2024
harshsoni2024 added this pull request to the merge queue Sep 30, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Sep 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-09-30T15:13:21Z)

Blocked the queue: py-tests-status

  • py-tests-postgres — py-tests-status, python / Verify Expected Jobs, python / Integration Tests (shard-3)

@harshsoni2024
harshsoni2024 added this pull request to the merge queue Sep 30, 2026
Merged via the queue into main with commit 92d5a55 Sep 30, 2026
120 of 122 checks passed
@harshsoni2024
harshsoni2024 deleted the fix/glue-lineage-display-name-and-iceberg-partition-keys branch September 30, 2026 22:16
harshsoni2024 added a commit that referenced this pull request Oct 19, 2026

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants