hughhhh opened a new pull request, #43759:
URL: https://github.com/apache/superset/pull/43759

   ### SUMMARY
   
   Third of four. Adds the server-side half of the dataset editor experience, 
plus the frontend types and save-payload wiring the editor UI will need.
   
   **The preview endpoint** shows an owner the predicate their transform would 
emit:
   
   ```
   POST /api/v1/dataset/<pk>/partition_mapping/preview/
     { "mapped_column": "event_time",
       "value_transform": "unix_timestamp(:value)",
       "sample_value": "2026-01-15 00:00:00" }
   → { "valid": true, "emitted_predicate": "dt_epoch >= 1768435200" }
   ```
   
   It fires a real warehouse query from a text input, so the order of its 
guards is the point:
   
   1. **Validate first, probe second.** Parse and denylist checks run before 
anything reaches the engine, so a half-typed transform — by definition 
unparseable, and most of what a text input produces — costs zero queries.
   2. **Shared cache.** Same evaluator and probe cache as the query path, so 
preview and runtime cannot drift and a previewed transform warms the chart path 
for free.
   3. **Server-side rate limit**, per user and dataset. Debouncing on the 
client is a courtesy, not a guard: a held keydown, or a few owners with the 
editor open, is sustained load on a production cluster.
   
   Guarded by `@protect()` plus per-object `raise_for_editorship`, and gated on 
the feature flag.
   
   **Frontend — plumbing, not UI:**
   
   - `partition_column` / `partition_mapped_column` in the dataset save 
payload, and `partition_value_transform` / `partition_transform_is_monotonic` 
in the per-column whitelist. Anything outside that whitelist is silently 
dropped on save, so this is load-bearing.
   - `clearDanglingPartitionMapping`, applied after a metadata sync. The 
backend clears a dangling mapping too on the authoritative `override_columns` 
path (PR 1); this keeps the editor's own state honest in between, so an owner 
is never looking at a mapping pointing at a column the table no longer has.
   - A test pinning down that a sync **preserves** a hand-written transform — 
the failure the whitelist and the merge logic could each cause quietly.
   
   The visual editor controls — the partition column select, the `PARTITION` 
tag, the row-expand section with the transform input and "Transform preserves 
ordering" checkbox — are **not** in this PR.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — no rendered UI in this PR.
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   pytest tests/unit_tests/datasets/partition_mapping_preview_test.py
   cd superset-frontend && npx jest src/components/Datasource
   ```
   
   The preview tests assert the guard *ordering*, not just the outcomes: 
several stub the probe with `side_effect=AssertionError("probe must not run")`, 
so they fail if validation ever stops short-circuiting ahead of the engine call.
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [x] Required feature flags: `PARTITION_FILTER_MAPPING` (off by default)
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to