You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rusackas (via GitHub)" <gi...@apache.org> on 2026/07/27 02:11:42 UTC
[PR] fix(pivot-table): keep each Rows field as its own CSV/XLSX column [superset]
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(pivot-table): keep each Rows field as its own CSV/XLSX column [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #42443:
URL: https://github.com/apache/superset/pull/42443#issuecomment-5086604985
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(pivot-table): keep each Rows field as its own CSV/XLSX column [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #42443:
URL: https://github.com/apache/superset/pull/42443#discussion_r3654035518
##########
tests/unit_tests/charts/test_client_processing.py:
##########
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-from io import BytesIO
+from io import BytesIO, StringIO
Review Comment:
**Suggestion:** The newly imported `BytesIO` is not used by this test file, leaving a dead import that will trigger the repository's unused-import lint check. Remove it or use it in an XLSX regression test. [possible bug]
<details>
<summary><b>Severity Level:</b> Minor ๐งน</summary>
```mdx
- โ ๏ธ CI lint checks may reject the test file.
- โ ๏ธ `BytesIO` adds dead code to the test module.
```
</details>
<details>
<summary><b>Steps of Reproduction โ
</b></summary>
```mdx
1. Run the new regression test
`test_apply_client_processing_csv_format_pivot_table_multiple_rows()` at
`tests/unit_tests/charts/test_client_processing.py:3155`; it uses `StringIO` at line 3197
but does not use `BytesIO`.
2. Run the repository's configured Python lint or unused-import check against
`tests/unit_tests/charts/test_client_processing.py`.
3. The checker reports `BytesIO` imported but unused at
`tests/unit_tests/charts/test_client_processing.py:18`.
4. The test itself still executes successfully because Python permits unused imports; the
defect affects lint/quality checks rather than CSV processing behavior.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=cc7441ddc70548a792589b6f9c651654&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=cc7441ddc70548a792589b6f9c651654&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** tests/unit_tests/charts/test_client_processing.py
**Line:** 18:18
**Comment:**
*Possible Bug: The newly imported `BytesIO` is not used by this test file, leaving a dead import that will trigger the repository's unused-import lint check. Remove it or use it in an XLSX regression test.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42443&comment_hash=2f0e6dd6e62a2fdae66492c9e0895d301d17bdc004b7a4e85d226f2f4be0eef4&reaction=like'>๐</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F42443&comment_hash=2f0e6dd6e62a2fdae66492c9e0895d301d17bdc004b7a4e85d226f2f4be0eef4&reaction=dislike'>๐</a>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(pivot-table): keep each Rows field as its own CSV/XLSX column [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #42443:
URL: https://github.com/apache/superset/pull/42443#issuecomment-5086624814
<!-- Bito Reply -->
The flagged issue is correct: `BytesIO` is imported in `tests/unit_tests/charts/test_client_processing.py` but is not used in the test file, which will cause linting failures. To resolve this, you should remove the unused `BytesIO` import.
I have implemented the fix below. Regarding other comments on this PR, there are no additional comments in the provided review data. If you have other concerns, please let me know.
**tests/unit_tests/charts/test_client_processing.py**
```
from io import StringIO
import pandas as pd
```
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(pivot-table): keep each Rows field as its own CSV/XLSX column [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #42443:
URL: https://github.com/apache/superset/pull/42443#issuecomment-5086625356
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/42443?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `0%` with `5 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 56.00%. Comparing base ([`e54eccd`](https://app.codecov.io/gh/apache/superset/commit/e54eccd5fb8302fcdc6bebf3777307d2e473b24f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`9f93591`](https://app.codecov.io/gh/apache/superset/commit/9f93591a0644a3880eded623611dd00597282cb4?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/42443?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [superset/charts/client\_processing.py](https://app.codecov.io/gh/apache/superset/pull/42443?src=pr&el=tree&filepath=superset%2Fcharts%2Fclient_processing.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvY2hhcnRzL2NsaWVudF9wcm9jZXNzaW5nLnB5) | 0.00% | [5 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/42443?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
> :exclamation: There is a different number of reports uploaded between BASE (e54eccd) and HEAD (9f93591). Click for more details.
>
> <details><summary>HEAD has 48 uploads less than BASE</summary>
>
>| Flag | BASE (e54eccd) | HEAD (9f93591) |
>|------|------|------|
>|python|43|1|
>|presto|7|1|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #42443 +/- ##
==========================================
- Coverage 65.25% 56.00% -9.25%
==========================================
Files 2795 2795
Lines 157639 157643 +4
Branches 36052 36054 +2
==========================================
- Hits 102862 88291 -14571
- Misses 52800 68527 +15727
+ Partials 1977 825 -1152
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/42443/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage ฮ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/42443/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [mysql](https://app.codecov.io/gh/apache/superset/pull/42443/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [postgres](https://app.codecov.io/gh/apache/superset/pull/42443/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/42443/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `40.30% <0.00%> (-0.01%)` | :arrow_down: |
| [python](https://app.codecov.io/gh/apache/superset/pull/42443/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `40.30% <0.00%> (-18.70%)` | :arrow_down: |
| [sqlite](https://app.codecov.io/gh/apache/superset/pull/42443/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [unit](https://app.codecov.io/gh/apache/superset/pull/42443/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/42443?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(pivot-table): keep each Rows field as its own CSV/XLSX column [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #42443:
URL: https://github.com/apache/superset/pull/42443#discussion_r3654282059
##########
tests/unit_tests/charts/test_client_processing.py:
##########
@@ -15,7 +15,7 @@
# specific language governing permissions and limitations
# under the License.
-from io import BytesIO
+from io import BytesIO, StringIO
Review Comment:
`BytesIO` is used elsewhere in this file (lines 2867, 2926) for the XLSX tests โ not dead code, just not touched by this particular new test.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(pivot-table): keep each Rows field as its own CSV/XLSX column [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas merged PR #42443:
URL: https://github.com/apache/superset/pull/42443
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org