Repository navigation
fix(glue): ingest AWS Glue table parameters as custom properties[Backport #33333 - 2.0] - #34269
Conversation
) * Fixes #31467: ingest AWS Glue table parameters as custom properties Glue tables never carried custom properties. Two gaps: GlueSource builds its own CreateTableRequest and never set `extension`, and GlueTable.Parameters was typed as a model with a single `table_type` field, so Pydantic discarded every other Glue parameter at validation. Wiring the extension alone would have ingested nothing. Glue parameters now map onto the table extension when `includeCustomProperties` is enabled, for every table type rather than Iceberg only, since every Glue table carries Parameters. The sanitize/register/dedupe logic Athena had inline moves to a shared CustomPropertyExtensionMixin so both connectors use one implementation. The refactor is behaviour preserving: Athena's existing 49 tests pass untouched. Three defects found while extracting it: - Values were not coerced to str. Custom properties are registered as `string` and the server validates each value against that schema, so a non-string Glue parameter would have rejected the whole table, not just the property. - The `string` property type ref was fetched even when the feature was off. - The name sanitizer could emit names starting with `_`, `.` or `-`, which the server's customPropertyName pattern rejects. The failure was swallowed as a warning, so the property was silently dropped. Reachable for Glue because parameter keys are operator authored. The registration cache is now a bounded LRUCache rather than an unbounded set. Athena runs the table node multi threaded, so the collision check tolerates a concurrent eviction between the membership test and the read. Note: connector supplied extensions land on an entity's first write only. EntityRepository.updateExtension reverts bot PUTs and does not consult overrideMetadata, so later parameter changes do not propagate. Tracked separately in #33324. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * Address review: lazy logging, falsy values, visible name collisions - Use lazy %-style logging arguments. The repo grandfathers existing f-string logging via .ruff-g004-baseline.json, so a new file gets none and check_ruff_suppressions.py rejected all three call sites. This is what the py-checkstyle job was failing on; G004 is also in FORBIDDEN_SUPPRESSION_CODES, so a noqa is not an option. - Drop only None and empty string, not every falsy value. Glue extras are not coerced by the model, so a parameter can arrive as 0 or False, and the old `if not prop_value` discarded those before the str() conversion. Absent table_type still dumps as None and is still dropped. - Report a sanitized-name collision at warning rather than debug. Two distinct source keys that sanitize alike write to the same extension entry, so one value is lost; Glue parameter keys are operator authored, so this is reachable. Kept last-wins rather than appending a hash, which would produce cryptic property names for a rare case, but the loss is no longer silent. The common case, one key seen across many tables, stays quiet. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * Prune two obsolete G004 baseline entries Moving Athena's custom property logic onto the shared mixin removed two f-string logging calls that were grandfathered in .ruff-g004-baseline.json. check_ruff_suppressions.py --check fails on a stale baseline, so py-checkstyle was still red after the lazy-logging fix. Note for anyone regenerating this file locally: .nox is not in the script's EXCLUDED_DISCOVERY_DIRS, so `--prune` will fold site-packages violations into the baseline unless that directory is moved aside first. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * Address review: collision-free property names, never retype an existing definition Two ways a source key could lose its value or damage unrelated tables. Distinct keys collapsing into one name. Sanitizing is many to one: `a/b` and `a@b` both reduce to `a__b`, and `_x` is prefixed to the `p__x` a source can send verbatim. Both keys then shared one definition and one extension entry, so whichever came last silently overwrote the other and the definition's displayName described the wrong key. A warning reported the loss without preventing it. Any name the sanitizer rewrites now carries an 8 hex digest of the raw key, derived from that key alone - never from iteration order or the registration cache, either of which would make the winner differ between runs. Names that already satisfy the server pattern are untouched. Existing definitions being retyped. A custom property definition is global to the entity type, so registering a Glue parameter named `retention` over an existing integer `retention` invalidated the values every other table held for it. Registration now consults the entity type's definitions first: an incompatible one skips the property with a warning, a compatible `string` one is reused without a PUT so a curated displayName and description survive, and only an unclaimed name is created. A failed listing falls back to registering, since losing the guard beats losing the feature. Behaviour change for Athena: a key containing characters outside [A-Za-z0-9_.-] now sanitizes to a different name than before, orphaning the definition it created previously. Those are exactly the keys that were at risk of colliding. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * Keep writing to a custom property name registered before disambiguation Appending a digest to every rewritten name renamed properties an existing Athena install had already ingested: re-running registered a second definition under the suffixed name while the original, and the values every table held against it, were left orphaned. Registration already snapshots the entity type's definitions to avoid retyping one, and those carry displayName, which is the raw source key for anything this mixin registered. So before falling back to the disambiguated name, look for the undisambiguated one and reuse it when it is a string definition whose displayName is this exact key. An upgraded install keeps writing where it already wrote, a fresh one gets the collision-free name, and a second key reducing to the same base still takes the suffix - so the key that lost the collision before now gets a property of its own. A legacy name claimed by a different key, or typed as something this code never creates, is left alone. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * Fail closed when definitions are unreadable, bound the definition snapshots Two review findings on the existing-definition lookup. An unreadable listing was treated as an empty one, so every source key looked unclaimed and the PUT that followed could replace a user's same-named property - its type, display name and config. A timeout or a missing permission was enough to reintroduce exactly the corruption the lookup was added to prevent, and the listing is its own GET, so the registration call failing alongside it was never guaranteed. The listing is now fetched once per entity rather than per property, and an unreadable one skips the extension entirely. The failure is not cached, so a transient one costs that entity its extension rather than disabling custom properties for the rest of the run. The snapshots were held in a plain dict keyed by entity type. Only Table is passed today, but build_entity_extension takes an arbitrary entity_type and each entry holds a whole server response, so it is a cache and the repo requires bounded ones. It is now an LRUCache; an evicted type is simply listed again. Also records why the check-register-cache sequence is deliberately not atomic: two Athena schema workers can miss the same first-seen name and both PUT, but the PUT is idempotent and the name is cached immediately after, so the cost is one redundant round trip per name per run - cheaper than holding a lock across a network call. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * Record a created definition so an evicted name is not registered twice A successful registration was recorded only in _processed_prop, leaving the definitions snapshot saying the name was still free. _processed_prop is bounded at 1024 entries, so a catalog with more distinct parameter keys than that evicts names this run created, and the next table registered them again. That second call is not a no-op. create_or_update_custom_property PUTs displayName, description and customPropertyConfig, so it rewrites the live property - and the reuse path that protects a curated definition only fires for definitions the snapshot knows about. Recording the definition on success closes the window and drops the extra round trip; a failed registration is still not recorded, so the next table retries it. The snapshot now converges on what the server holds for the entity type rather than only what it held when the run started, which is the same set it would return if listed again - not growth with the catalog. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> * Scope processed names by entity type, share one definitions snapshot Two issues from review, both in how the caches relate to each other. _processed_prop was keyed by sanitized name alone while the definitions it stands in for are scoped by entity type. Once a Table call cached a name, a call for another entity type skipped registration and emitted the property anyway, although that type has no definition for it - which the server rejects for the whole entity, not just the property. Only Table is passed today, but build_entity_extension accepts any entity type, so the API invites it. The cache key is now "<entity type>:<name>". _existing_definitions checked, fetched and stored without holding anything, so concurrent Athena schema workers could each build their own snapshot and the last store would replace the rest, discarding the definitions those workers had recorded and re-sending them once the processed-name cache evicted. The fetch is now behind a double-checked lock, so every worker shares one snapshot and a name recorded by any of them is visible to all. It serialises one listing per entity type per run, unlike the per-property PUT, which is still deliberately unsynchronised. The concurrency tests slow the listing on purpose: with an instant mock the first worker finishes before the others look, so the race never happens and the tests pass against the unfixed code. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com> (cherry picked from commit 43ddb8a)
❌ 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 |
Code Review ✅ Approved🟡 Medium risk · Adds Glue table-parameter custom properties and changes Athena property registration behavior. Backport of AWS Glue table parameters ingestion as custom properties to the 2.0 branch. No issues found. 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 |
|
✅ Playwright Results — workflow succeededValidated commit ✅ 110 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) 52m 2s ⏱️ Max setup 3m 26s · max shard execution 12m 16s · max shard-job elapsed before upload 18m 53s · reporting 5s 🌐 212.17 requests/attempt · 1.79 app boots/UI scenario · 0.00% 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 |



backport of 43ddb8a on 2.0
ref - #33333