Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicated values in pivoted CSV export with repeated metric labels #32373

Open
3 tasks done
Jockxtar opened this issue Feb 25, 2025 · 1 comment
Open
3 tasks done

Duplicated values in pivoted CSV export with repeated metric labels #32373

Jockxtar opened this issue Feb 25, 2025 · 1 comment
Labels
data:csv Related to import/export of CSVs viz:charts:pivot Related to the Pivot Table charts

Comments

@Jockxtar
Copy link

Bug description

I'm trying to make the "Export to pivoted .CSV" option work for a (relatively) convoluted pivot table and I found some issues. I will create a bug report for each of them.

Description

If there are several metrics with the same label, the values of the first metric are repeated on the others.

Steps to reproduce:

  1. Create a pivot table.
  2. Add at least 2 metrics with the same label.
  3. Click on 'Download' -> 'Export to pivoted .CSV'

Proposed solution

Instead of filling the csv file based on the metrics' labels, I think it should use the metrics names since they are always unique.

Screenshots/recordings

Image

Image

Superset version

4.1.1

Python version

3.10

Node version

I don't know

Browser

Firefox

Additional context

Source code:

I'm using version 4.1.1, but I tried updating 'post_processing.py' to match what's in the master branch's 'client_processing.py' since I needed PR #29898 (which doesn't seem to affect this issue).

Feature flags:

"DASHBOARD_RBAC": True,
"ENABLE_TEMPLATE_PROCESSING": True,
"CACHE_QUERY_BY_USER": True,
"CACHE_IMPERSONATION": True

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
@dosubot dosubot bot added data:csv Related to import/export of CSVs viz:charts:pivot Related to the Pivot Table charts labels Feb 25, 2025
Copy link

dosubot bot commented Feb 25, 2025

The issue you're experiencing with duplicated values in the pivoted CSV export when using repeated metric labels is related to how Superset handles metric labels during the export process. Superset ensures uniqueness in metric identification by validating that there are no duplicate labels before proceeding with the export. If duplicate labels are detected, it raises a QueryObjectValidationError to prevent the export [1].

Your proposed solution to use metric names instead of labels for filling the CSV file is a valid approach, as metric names are inherently unique. This change would prevent the duplication issue you're encountering.

To address this issue, you might consider modifying the export logic to use metric names instead of labels. This would involve ensuring that the export process references the unique metric identifiers rather than potentially duplicated labels.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data:csv Related to import/export of CSVs viz:charts:pivot Related to the Pivot Table charts
Projects
None yet
Development

No branches or pull requests

1 participant