rusackas opened a new pull request, #42443: URL: https://github.com/apache/superset/pull/42443
### SUMMARY When a pivot table has multiple "Rows" fields selected, exporting to pivoted CSV (or a scheduled report using XLSX) collapsed all of those fields into a single space-joined column, instead of giving each field its own column like the table rendered in Explore. `apply_client_processing` in `superset/charts/client_processing.py` always flattened the (possibly multi-level) row index into one joined string before serializing, which is necessary for JSON output (dict keys must be strings) but throws away information for CSV/XLSX. This PR only flattens the row index for JSON, and for CSV/XLSX keeps it as a `MultiIndex` so pandas writes one column per "Rows" field, matching the behavior in Explore. Test-first: added a regression test that fails on master (single merged column) and passes with the fix (one column per Rows field). ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF N/A (backend CSV output change, see issue for the before screenshot) ### TESTING INSTRUCTIONS - `pytest tests/unit_tests/charts/test_client_processing.py` - Manually: create a pivot table chart with 2+ fields under "Rows", then use Download > Export to pivoted CSV. Each "Rows" field should now be its own column. ### ADDITIONAL INFORMATION - [x] Has associated issue: Fixes #32369 - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration - [ ] 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]
