Skip to content

Fixes #36788: keep OpenLineage column lineage for names with reserved characters or dots - #36789

Merged
akashverma0786 merged 5 commits into
open-metadata:mainfrom
ccurve1870:fix/36788-openlineage-reserved-column-names
Nov 24, 2026
Merged

akashverma0786 merged 5 commits into
open-metadata:mainfrom
ccurve1870:fix/36788-openlineage-reserved-column-names

Conversation

@ccurve1870

@ccurve1870 ccurve1870 commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #36788

Related: #35973, which closes the same reserved-character gap for the dbt DataModel.

The rule is recorded in ADR:2026-11-01-openlineage-fields-resolve-against-stored-columns.

Spark reports column lineage with raw column names. Both OpenLineage paths built each FQN by concatenating a column name, so a>b and c.d matched neither a__reserved__arrow__b nor "c.d", and validateLineageDetails dropped their lineage while the event still succeeded.

Server API (POST /v1/openlineage/lineage)

  • OpenLineageMapper now resolves each field against the stored columns of its table. A dot in a field is either part of a name ("c.d") or a path to a nested column (s.x), and only the stored columns can tell which, so quoting every dotted name would have broken nested lineage.
  • A field is tried as sent first, so a column already stored with a raw > keeps matching, then with the name connectors store (OpenLineageColumnMapper.toStoredName, in step with replace_separators in custom_basemodel_validation.py).
  • A field with no stored column, and any dataset that is not a table, keeps today's concatenation.
  • OpenLineageColumnMapper.toColumn uses the same stored name, so a table created from an event matches what a later metadata ingestion writes.

OpenLineage connector (Kafka/Kinesis)

  • This path uses PUT /v1/lineage and never reaches OpenLineageMapper. _match_column_name becomes _match_column_fqn and returns the FQN of the matched column, because a fetched column name is decoded and differs from its FQN segment. A field with no stored column keeps the lowercase fallback.

Backport request: the bug reproduces on 2.0.6, whose OpenLineageMapper has the same concatenation. 2.0 has no OpenLineageColumnMapper, so a cherry-pick will conflict there. Could this be backported to 2.0 as well?

Type of change:

  • Bug fix

High-level design:

N/A — small change.

Tests:

Use cases covered

  • Spark column lineage reaches stored columns named a>b, c.d, e.>f and .>
  • A dotted path still reaches a nested column (s.x)
  • A column stored with a raw > keeps matching
  • A table auto-created from an event stores reserved characters as connectors do

Unit tests

  • I added unit tests for the new/changed logic.
  • Files added/updated: OpenLineageMapperTest, OpenLineageColumnMapperTest, OpenLineageEntityResolverTest, ingestion/tests/unit/topology/pipeline/test_openlineage.py
  • With the fixes reverted, mapRunEvent_fieldWithReservedCharacter_reachesTheStoredColumn, mapRunEvent_fieldWithDot_reachesTheQuotedColumn, createdColumnTakesItsStoredName and test_get_column_lineage_uses_stored_fqn_of_special_column_names fail.
  • Connector: test_openlineage.py and test_openlineage_ownership.py, 148 passed, run with this branch's connector sources on the openmetadata-ingestion==2.0.6.0 generated models. ruff format --check and ruff check pass with ruff 0.15.22.

Backend integration tests

  • I added integration tests in openmetadata-integration-tests/ for new/changed API endpoints.
  • Files added/updated: OpenLineageLineageResolutionIT#columnLineage_reachesStoredColumnsOfSpecialFieldNames

Run locally on JDK 21 with -Pmysql-elasticsearch -DintegrationTests.lane=parallel, base ce5ecdd53c:

  • All 20 IT classes selected by plan_local_java_tests.py, on the first commit: 1256 run, 0 failures, 0 errors, 64 skipped
  • On the head of this PR: OpenLineageLineageResolutionIT and OpenLineageResourceIT, 51 run, 0 failures; the 4 impacted unit test classes, 159 run, 0 failures

Ingestion integration tests

  • Not run locally: tests/integration/openlineage/ covers Kafka offsets, which this PR does not change. Connector behaviour is covered by the unit test above and the manual run below.

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

  1. Started the official 2.0.6 stack with Postgres tables holding columns a>b, c.d, e.>f and .>, and ran the Postgres metadata ingestion.
  2. Copied one table to the other with Spark 4.0.2 and openlineage-spark_2.13:1.55.0, sending events to /api/v1/openlineage/lineage.
  3. Without the fix: HTTP 200, and the edge held only the columns with plain names (checked with a>b and c.d, where id and amount were kept).
  4. With the same logic ported to the 2.0.6 service jar: the edge holds all six columns, including "e.__reserved__arrow__f" and ".__reserved__arrow__".
  5. Replayed the same Spark events through Kafka into the connector against the unmodified 2.0.6 server: id and amount only with the current main connector, all six columns with this branch.

UI screen recording:

Not applicable — backend-only bug fix.

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 #36788 above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • I have added a test that covers the exact scenario we are fixing. For complex issues, comment the issue number in the test for future reference.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 4/5

Fix nested column matching in the connector and add the required result assertions before merging.

Findings

  1. P1 Nested column mappings disappear ▶
  2. P2 Wrong mappings can pass tests ▶

Summary

The PR resolves OpenLineage fields through stored column FQNs and gives newly created columns the same reserved-character spelling used by ingestion.

  • The server resolves OpenLineage fields to stored column paths.
  • The Kafka and Kinesis connector uses matched columns’ stored FQNs.
  • Tables created from OpenLineage events use connector-style column names.

Acknowledgments by ccurve1870 in the supplied decision record: literal dotted names and nested paths may share one lookup key, with the later column winning; the Java and Python keyword lists have no shared parity test.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  E[OpenLineage field] --> J[Server lookup]
  E --> P[Connector lookup]
  J --> T[Stored columns and children]
  P --> F[Stored top-level columns]
  T --> Q[Stored column FQN]
  F --> Q
  P -->|Nested field misses| R[Raw lowercase fallback]
  Q --> V[Lineage write]
  R --> V
  V -->|Unknown column name| D[Mapping dropped]
Loading

Reviews (1) · Last reviewed commit: "Move the special-field-names IT out of t..." · Reviewed by Greptile

…dots

extractColumnLineage built column FQNs from the raw field name, so `a>b` and
`c.d` matched neither `a__reserved__arrow__b` nor `"c.d"`, and
validateLineageDetails dropped their lineage without reporting it.

Match each field against the stored columns of its table instead. A dot in a
field is either part of a name or a path to a nested column, and only the
stored columns can tell which. A table created from an event now stores the
same names connectors do.
The connector built column FQNs from the name of the fetched column. That name
has its reserved characters decoded and its dots unquoted, so `a>b` and `c.d`
matched no real column and the server dropped their lineage without reporting
it. Send the FQN the column already carries.
@ccurve1870
ccurve1870 requested review from a team as code owners November 1, 2026 13:29
@ccurve1870
ccurve1870 requested a review from ulixius9 November 1, 2026 13:29
@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

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

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 commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

extractColumnLineage read every input for every output, including inputs the
facet never names, so an event with several outputs repeated those table loads.
Keep the read columns for the whole event and load an input only when a field
references it.

Add the decision record for how a field resolves to a stored column and which
name a created column takes. The Java server and the Python ingestion now have
to agree on that format, and the PR description does not reach git log.
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@ulixius9 ulixius9 added the safe to test Add this label to run secure Github workflows on PRs label Nov 23, 2026
Resolve the conflict with open-metadata#36867 in the OpenLineage connector:
_match_column_fqn keeps returning the stored column FQN, and keeps main's
rule that an unmatched field of a sharded table resolves to None and is
skipped. Add a test for that combined behaviour.
The test had been inserted between assertAuditFieldsStamped and its
Javadoc, so the Javadoc described the wrong method.
@gitar-bot

gitar-bot Bot commented Nov 23, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk 2 closed / 2 findings

Resolving OpenLineage fields against stored column FQNs changes lineage mapping; a mismatch could omit or misattribute column lineage.

Keeps OpenLineage column lineage for names with reserved characters or dots by resolving event fields against stored column FQNs on both the server and the connector. Resolved this session: the shared reserved-name encoding and field resolution order are now recorded, and input table columns are read once per event rather than re-fetched for every output dataset. No open issues found.

✅ 2 closed
✅ Quality: Shared reserved-name encoding and field resolution order are unrecorded

📄 openmetadata-service/src/main/java/org/openmetadata/service/openlineage/OpenLineageColumnMapper.java:111-124 📄 openmetadata-service/src/main/java/org/openmetadata/service/openlineage/OpenLineageMapper.java:64-75
This PR adds a second copy of the reserved-keyword encoding in Java: OpenLineageColumnMapper.toStoredName, whose Javadoc says it "Must stay in step with replace_separators in custom_basemodel_validation.py". It also sets a resolution rule that the description gives only in prose: "A field is tried as sent first so a column already stored with a raw > keeps matching, then with the connector-style stored name", and "Tables created from an OpenLineage event use the same stored name as connectors". That makes the encoding a derived format that the Python ingestion and the Java server now have to agree on. No record in docs/decisions/ states it, and the repository squash-merges, so the description never reaches git log. Please add a record stating: "OpenLineage column names are stored with the connector reserved-keyword encoding (::, >, ", , \r, → __reserved__*__), kept identical to replace_separators. A lineage field resolves against stored column FQNs by dotted path: first as sent, then encoded, and only then falls back to <datasetFqn>.<field>." Name OpenLineageColumnMapperTest and OpenLineageMapperTest as its guards, and cite the record from toStoredName.

✅ Performance: Input table columns are re-fetched for every output dataset

📄 openmetadata-service/src/main/java/org/openmetadata/service/openlineage/OpenLineageMapper.java:165-170 📄 openmetadata-service/src/main/java/org/openmetadata/service/openlineage/OpenLineageMapper.java:345-347
extractColumnLineage runs once per output from buildEdges, and each call runs readColumns (an Entity.getEntity(TABLE, id, columns) load) for every input, even inputs the facet never references. An event with O outputs and I inputs therefore does O×I input table loads plus O output loads, where I + O would be enough. Read the input columns once in buildEdges and pass the Map<String, DatasetColumns> into extractColumnLineage. Better still, load them lazily with computeIfAbsent so only inputs named in the facet are fetched.

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

@akashverma0786
akashverma0786 merged commit cff416d into open-metadata:main Nov 24, 2026
65 of 67 checks passed
Khairajani added a commit that referenced this pull request Nov 26, 2026
… characters or dots (#36789) (#38902)

* Fix OpenLineage column lineage for names with reserved characters or dots

extractColumnLineage built column FQNs from the raw field name, so `a>b` and
`c.d` matched neither `a__reserved__arrow__b` nor `"c.d"`, and
validateLineageDetails dropped their lineage without reporting it.

Match each field against the stored columns of its table instead. A dot in a
field is either part of a name or a path to a nested column, and only the
stored columns can tell which. A table created from an event now stores the
same names connectors do.

* Use stored column FQNs in OpenLineage connector column lineage

The connector built column FQNs from the name of the fetched column. That name
has its reserved characters decoded and its dots unquoted, so `a>b` and `c.d`
matched no real column and the server dropped their lineage without reporting
it. Send the FQN the column already carries.

* Read OpenLineage input columns once per event and record the field rule

extractColumnLineage read every input for every output, including inputs the
facet never names, so an event with several outputs repeated those table loads.
Keep the read columns for the whole event and load an input only when a field
references it.

Add the decision record for how a field resolves to a stored column and which
name a created column takes. The Java server and the Python ingestion now have
to agree on that format, and the PR description does not reach git log.

* Move the special-field-names IT out of the helpers section

The test had been inserted between assertAuditFieldsStamped and its
Javadoc, so the Javadoc described the wrong method.

---------



(cherry picked from commit cff416d)

Co-authored-by: ccurve1870 <83492121+ccurve1870@users.noreply.github.com>
Co-authored-by: ccurve1870 <hammerous@gmail.com>
Co-authored-by: ulixius9 <mayursingal9@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

OpenLineage column lineage is silently dropped for columns with > or . in their name

4 participants