Repository navigation
fix(dataProducts): key ODPS import identity on productID, not display name (2.0 backport) - #34193
Conversation
… name ODPS import derived the entity name from the ODPS `name` (display label), sanitized: "[DEV] Alarms Info" became "DEV_Alarms_Info". `productID` (the stable ODPS identifier) was validated but never used. Since the merge path matches an existing product by entity name, re-importing a product whose display name differs from its slug never matched the existing one — it created a duplicate and left the original untouched. This also disagreed with our own exporter: toODPS writes productID from the entity identifier and name from displayName, so an exported document could not be re-imported onto itself. Map ODPS productID -> entity name (sanitized to an FQN-safe slug) and ODPS name -> displayName. Matching then keys on productID, so re-imports update the same product. Import and export are now symmetric. Updates ODPSConverterTest assertions to the new mapping and adds DataProductResourceIT#importFromODPS_matchesExistingProductByProductId, which fails without the fix (re-import creates a duplicate).
Now that the entity name comes from productID, dotted identifiers are the
common case (reverse-domain IDs, and toODPS writes the FQN into productID).
DataProduct uses quoteFqn=false, so a dotted name is persisted as a quoted
FQN ("a.b"), but findExistingByName looked it up with the raw unquoted name
and never matched — the PUT re-import then took the create path and failed
with 409 Conflict. Quote the lookup (as DataProductRepository already does
for its rename check); a name with no dots is unchanged.
The re-import IT now uses a dotted productID, which reproduces the 409
without this change.
The round-trip spec gave the re-import a "fresh identity" by renaming only the ODPS `name`. Now that import identity comes from `productID`, leaving productID unchanged made the re-import collide with the source product (409 instead of 201). Rename productID (the identity field) so the exported document re-homes onto a new product; name maps to displayName.
…names round-trip Entity names allow spaces, brackets and single colons (entityName forbids only `::`, `>`, `"`, control chars, max 256), but sanitizeEntityName slugs to [a-zA-Z0-9_.-] capped at 64. So a product named e.g. "Customer 360" (created via UI/API) exports productID="Customer 360" and re-imported as "Customer_360" — no match, duplicate created; long/punctuated productIDs also collide on the 64-char cut. Match the existing product by the raw productID (which export writes as the entity FQN) before falling back to the sanitized name, and treat a productID that isn't a valid entity name as "no match". smartMerge/fullReplace already keep the existing identity, so a matched product is updated in place. Adds importFromODPS_matchesExistingNonSlugProductByProductId, which fails without the raw-productID lookup (re-import creates a duplicate).
… entity-name chars Deriving the entity name from productID meant an all-non-ASCII or punctuation-only productID (which sanitizes to empty) failed the import with a 400 — a regression for documents that imported fine before productID became the identity (they keyed on the name). Fall back to sanitizing the name in that case, so those documents keep importing. Also fixes a misleading error: the "ODPS product name '<x>'" message no longer reports a productID value under the "name" label — the throw now only fires for the name field (productID goes through the non-throwing sanitizeEntityNameOrNull). Both fields unusable still fails, with the value that was actually rejected. Adds fromODPS_fallsBackToNameWhenProductIdNotSanitizable (fails without the fallback).
❌ 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 |
✅ Playwright Results — workflow succeededValidated commit ✅ 776 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking 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) 53m 17s ⏱️ Max setup 3m 25s · max shard execution 19m 4s · max shard-job elapsed before upload 22m 26s · reporting 4s 🌐 200.05 requests/attempt · 2.50 app boots/UI scenario · 32.08% common-shard skew Optimization targets still in progress:
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
Code Review ✅ Approved 1 closed / 1 findings🔴 High risk · Risk could not be assessed, so high risk was applied as a precaution. ODPS import now derives data product entity names from the stable ✅ 1 closed✅ Bug: Products imported before this change duplicate on next PUT re-import
OptionsDisplay: compact → Counting what did not apply, without listing it. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|



Backport of #33993 to
2.0.Problem
ODPS import derived a data product's entity name from the ODPS
name(the editable display label); the stableproductIDwas validated but never used. Because the merge/update path matches by entity name, re-importing the same product under a changed name (or from an export) created a new, separate product instead of updating the existing one, and import was not symmetric with export. (OpenMetadata still blocks two products with the same name — these are distinct names for one logical product.)Fix
Map ODPS
productID→ entity name (sanitized) and ODPSname→ displayName, mirroring export, so matching keys onproductID. Plus: match by raw productID first (non-slug names round-trip), quote the lookup FQN (dotted productIDs match), and fall back to the name when a productID has no valid entity-name characters.Clean cherry-pick of the 5 commits from #33993 (2.0's ODPS files were identical to main's baseline). Build verified on 2.0; unit tests 36/36 and re-import ITs pass on main.
Fixes #33995