Skip to content

Backport to 2.0: map column lineage through STRUCT and ARRAY<STRUCT> fields - #37666

Merged
Khairajani merged 1 commit into
2.0from
cp-37259-2.0
Nov 12, 2026
Merged

Khairajani merged 1 commit into
2.0from
cp-37259-2.0

Conversation

@Khairajani

Copy link
Copy Markdown
Contributor

Describe your changes:

Backport of #37259 to 2.0, for #37258.

Query and view column lineage now reaches the fields of STRUCT and ARRAY columns, so tag and description propagation over lineage reaches nested fields in downstream views. Details and rationale are in #37259 and ADR:2026-11-06-sql-column-lineage-follows-nested-fields.

  • One conflict in sql_lineage.py: 2.0 still uses List/Optional typing, and it lacks to_table_entities (from a separate main PR that wasn't backported). I kept 2.0's lines and added only this PR's copied_columns parameter.
  • Not breaking: edges are only added, and nothing produced today changes.

Type of change:

  • Bug fix

Tests:

  • ingestion/tests/unit/lineage/test_nested_column_lineage.py (55 tests), run against this branch's code.
  • Lineage unit tests on this branch (tests/unit/lineage, test_query_parser.py, test_db_utils.py): 518 passed. basedpyright against 2.0's baseline and ruff are clean.

🤖 Generated with Claude Code

…ds (#37259)

* fix(lineage): map column lineage through STRUCT and ARRAY<STRUCT> fields

* fix(lineage): resolve a STRUCT field path only where nothing else can own its name

* test(lineage): anchor the no-lineage cases on an edge that must exist

* fix(lineage): resolve a STRUCT field path only from a table source; fix static checks

* fix(lineage): detect subqueries through the parser's public column lineage; pin root vs nested matching

* fix(lineage): copy nested fields only through a column the query copies unchanged; catch CTEs built from constants

* fix(lineage): carry nested fields only from the source column the final SELECT copies

* fix(lineage): match table columns and STRUCT field copies separately; skip target column lists

* fix(lineage): copy a STRUCT star's fields only when the star is plain and nothing else produces them
@Khairajani
Khairajani requested a review from a team as a code owner November 12, 2026 11:05
@Khairajani
Khairajani requested review from akashverma0786 and removed request for a team November 12, 2026 11:05
@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.

@Khairajani Khairajani added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Nov 12, 2026
@gitar-bot

gitar-bot Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

Backports column lineage mapping through STRUCT and ARRAY<STRUCT> fields so tag and description propagation reaches nested fields in downstream views. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

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

@Khairajani
Khairajani merged commit e7dc22c into 2.0 Nov 12, 2026
75 of 77 checks passed
@Khairajani
Khairajani deleted the cp-37259-2.0 branch November 12, 2026 20:07
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.

2 participants