Skip to content

Fixes #38485: Preserve per-input OpenLineage column transformations - #38615

Merged
Khairajani merged 7 commits into
open-metadata:mainfrom
iamkiayun:fix/38485-openlineage-transformations
Nov 26, 2026
Merged

Khairajani merged 7 commits into
open-metadata:mainfrom
iamkiayun:fix/38485-openlineage-transformations

Conversation

@iamkiayun

Copy link
Copy Markdown
Contributor

Fixes #38485

The REST endpoint and Python ingestion now keep each source column’s role when several columns feed the same output. An amount can carry DIRECT/AGGREGATION while a filter column carries INDIRECT/FILTER. Inputs with the same function can share a mapping.

Both paths preserve descriptions, masking, and producer order for multiple transformations. They use the older field-level description or type when an input lacks transformation details.

Regression coverage includes modern and legacy events, the Python connector’s emitted lineage request, and reading stored lineage back through the REST API.

Local verification

  • 215 Java unit tests and 31 REST integration tests passed.
  • 191 Python unit tests and 6 live Kafka and NATS integration tests passed.
  • Spotless, Ruff, and type checking for the two regenerated TypeScript models passed.

@iamkiayun
iamkiayun requested review from a team as code owners November 24, 2026 16:38
@github-actions

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 24, 2026 •

Copy link
Copy Markdown
Contributor

UI browser tests

Ran: all test files (no impact map from main yet)

Result: ✅ 1071 passed · 154 skipped

@Khairajani Khairajani added the safe to test Add this label to run secure Github workflows on PRs label Nov 25, 2026
"description": { "type": "string", "description": "A description of the transformation." },
"masking": { "type": "boolean", "description": "Whether the transformation masks data." }
},
"required": ["type"]

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.

Could we drop "required": ["type"] from inputFieldTransformation? With it, one transformation missing type fails the whole event (or batch) with a 400, while the mapper already skips those safely.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. In bed897cb7, inputFieldTransformation.type is optional. I tested both a single event and a batch containing an incomplete transformation alongside valid ones. Both were accepted, and the valid aggregation and filter were preserved. All 32 lineage REST integration cases passed with MySQL and OpenSearch.

The separate Collate build still reports only that mvn clean install -DskipTests exited with 1. Could someone with access to the downstream log share the first build error so I can follow up?

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.

About the Collate build failure: it comes from the branch base, not this diff. The branch is based on a main commit from 24 Nov, before PR #37592 made BackgroundJob.jobType a string. Since 25 Nov, Collate main calls JobDAO.insertJob(String, ...), and at this branch's base that method still takes BackgroundJob.JobType, so the Collate compile fails. PRs based on newer main passed the same check that morning. Merging main into the branch should clear it.

@TeddyCr
TeddyCr requested review from ulixius9 and removed request for TeddyCr November 25, 2026 22:25

private static String describeTransformation(InputFieldTransformation transformation) {
StringBuilder function = new StringBuilder(transformation.getType().strip());
if (StringUtils.isNotBlank(transformation.getSubtype())) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this supposed to be if else? if not we should use switch not write like this?

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.

They're not either/or. A transformation can have all three, like INDIRECT/FILTER (active only) [masked], so if/else or a switch would end up dropping parts. It's also the same style as buildDescription() in this class.

input_column,
)
function = self._column_function(input_field, field_spec)
columns_by_function[(output_table_fqn, input_table_fqn, output_column, function)].append(

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.

On an edge this connector already wrote before this change, the old mapping stays, and the new functions don't show in the UI.

Before this change, the connector stored one mapping per output column with all its inputs and no function, for example [amount, tax, flag] -> total. After the upgrade, the next run sends [amount, tax] -> total with DIRECT/AGGREGATION and [flag] -> total with INDIRECT/FILTER. The sink writes with check_patch=True, and _merge_column_lineage matches mappings on (fromColumns, toColumn). Neither new mapping matches the stored one, so the patch only appends. The edge ends up with all three mappings, the old one first.

The edge drawer reads the function with getColumnFunctionValue, which returns the first mapping that contains the pair. So amount -> total and flag -> total still show no function. This only happens when the inputs of one output column have different transformations. When they all share one, the key matches and the function is filled in. With the default overrideLineage: false the edge keeps this state on every later run. Edges written through the REST endpoint aren't affected, because addLineage replaces the stored column lineage.

I reproduced it locally. I stored the edge with the connector from this branch's base commit, then ran this branch's connector through add_lineage(check_patch=True) and applied the PATCH it sent to a running server, whose lineage PATCH code is the same as on this branch. Reading the edge back returns:

[amount, tax, flag] -> total   (no function)
[amount, tax]       -> total   DIRECT/AGGREGATION
[flag]              -> total   INDIRECT/FILTER

@Khairajani Khairajani Nov 26, 2026 •

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.

Fixed in b23811a. The old mapping now gets replaced by the new labelled ones, and I added a test for it.

Khairajani and others added 4 commits November 26, 2026 15:32
… its pairs

An edge the OpenLineage connector wrote before this change holds one unlabelled
line per output column. The next run splits it by function, the patch merge kept
the old line first, and the edge drawer read its empty function.
@gitar-bot

gitar-bot Bot commented Nov 26, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

Per-input transformation grouping and lineage merging alter persisted column mappings; malformed events could misstate provenance or replace legacy mappings.

Preserves each OpenLineage input's column transformation role when multiple columns feed the same output, so an amount can keep DIRECT/AGGREGATION while a filter column keeps INDIRECT/FILTER. Applies to both the REST endpoint and Python ingestion, with regression coverage for modern and legacy events. 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 8cf1dca into open-metadata:main Nov 26, 2026
43 of 45 checks passed
Khairajani added a commit that referenced this pull request Nov 26, 2026
…38615) (#38909)

* Preserve per-input OpenLineage column transformations

* Use typed column names for OpenLineage mappings

* Tolerate incomplete OpenLineage input transformations

* Replace a stored unlabelled column line once incoming lines label all its pairs

An edge the OpenLineage connector wrote before this change holds one unlabelled
line per output column. The next run splits it by function, the patch merge kept
the old line first, and the edge drawer read its empty function.

* Type the labelled column pairs like the merge's other keys

---------



(cherry picked from commit 8cf1dca)

Co-authored-by: Kia Yun <kiayun.0218@outlook.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 drops the per-input transformations of facet 1-2-0, so function is always empty

5 participants