bikash-barnwal opened a new pull request, #43186:
URL: https://github.com/apache/superset/pull/43186

   ### SUMMARY
   
   `validate_column_args` returned a bare `wrapped(df, **options)` without 
`functools.wraps`, so every decorated post-processing operation lost its 
`__name__`, `__doc__` and signature. 
`inspect.signature(pandas_postprocessing.pivot)` reported the wrapper's `(df, 
**options)` catch-all rather than `index`, `aggregates` and the rest — every 
operation looked like it accepts arbitrary keywords.
   
   That matters beyond tidiness. As #42926 describes, a chart's stored 
`query_context` is never migrated, so it can carry options an operation has 
since dropped — `pivot` no longer takes `flatten_columns` or `reset_index` — 
and replaying one raises `TypeError` from deep inside pandas on every 
non-Explore path (chart data API, alerts and reports, thumbnails, cache 
warm-up, CSV/Excel export, MCP tools). Any attempt to spot a stale option by 
introspection needs the real signature to be reachable first, and the missing 
`wraps` is precisely what hides it.
   
   **Scope:** this is the secondary defect called out in #42926. The missing 
`query_context` migration itself is *not* addressed here — that is a larger 
design question also tracked in #33152 and #31872 — so this says *Addresses* 
rather than *Fixes* and leaves the issue open.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   ```python
   >>> inspect.signature(pandas_postprocessing.pivot)
   (df: DataFrame, **options: Any)                       # before
   (df, index, aggregates, columns=None, metric_fill_value=None, ...)   # after
   ```
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   pytest 
tests/unit_tests/utils/pandas_postprocessing/validate_column_args_tests.py
   pytest tests/unit_tests/pandas_postprocessing 
tests/unit_tests/utils/pandas_postprocessing
   ```
   
   New tests assert the operation keeps its name and docstring, that its real 
parameters are introspectable, that the removed `flatten_columns` / 
`reset_index` are visibly absent, and that column validation still rejects 
unknown columns. Locally: 4 passed for the new file and **110 passed** across 
the post-processing suites.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: Addresses #42926
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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