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

feat(chart-data-api): make pivoted columns flattenable #10255

Merged
merged 2 commits into from Jul 8, 2020

Conversation

villebro
Copy link
Member

@villebro villebro commented Jul 8, 2020

SUMMARY

Currently the pivot operation doesn't work properly on the chart data endpoint due to column names being Tuple[str, ...], causing json.dumps to fail. This adds the option to flatten the column names in a similar manner to how viz.py does it (drop metric name if only single metric present, join column names with comma etc). In addition, the index is returned to the DataFrame as a regular column to keep the pivot output uniform with other post processing operations. The columns argument is also made optional to avoid having to do an additional ternary in buildQuery when building time series viz plugins with optional groupbys.

TEST PLAN

CI + new tests

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

Copy link
Member

@dpgaspar dpgaspar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but if calling pivot without columns is allowed we should have a test for that

@villebro villebro force-pushed the villebro/pivot-columns branch 2 times, most recently from 3271d0c to c4ae7da Compare July 8, 2020 10:08
@villebro villebro added the v0.37 label Jul 8, 2020
@villebro villebro merged commit baeacc3 into apache:master Jul 8, 2020
@villebro villebro deleted the villebro/pivot-columns branch August 14, 2020 07:15
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
* feat(chart-data-api): make pivoted columns flattenable

* Linting + improve tests
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.37.0 labels Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L v0.37 🚢 0.37.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants