Repository navigation
Fixes #38485: Preserve per-input OpenLineage column transformations - #38615
Khairajani merged 7 commits into
Conversation
❌ PR checklist incompleteThis 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 |
UI browser testsRan: all test files (no impact map from main yet) Result: ✅ 1071 passed · 154 skipped |
| "description": { "type": "string", "description": "A description of the transformation." }, | ||
| "masking": { "type": "boolean", "description": "Whether the transformation masks data." } | ||
| }, | ||
| "required": ["type"] |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
|
|
||
| private static String describeTransformation(InputFieldTransformation transformation) { | ||
| StringBuilder function = new StringBuilder(transformation.getType().strip()); | ||
| if (StringUtils.isNotBlank(transformation.getSubtype())) { |
There was a problem hiding this comment.
is this supposed to be if else? if not we should use switch not write like this?
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Fixed in b23811a. The old mapping now gets replaced by the new labelled ones, and I added a test for it.
… 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.
Code Review ✅ Approved 🟡 Medium riskPer-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 VerificationRules No rules evaluated Functional validation Not enabledAuto-approval Not enabledFor more verification details, comment OptionsDisplay: compact → Showing compact verification results. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
…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>
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/AGGREGATIONwhile a filter column carriesINDIRECT/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