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

fix: Ensure the reporting framework handles charts with no data #23585

Merged

Conversation

john-bodley
Copy link
Member

@john-bodley john-bodley commented Apr 5, 2023

SUMMARY

This PR resolves a couple of bugs with the reporting framework where the chart payload contains no data.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

Added unit tests (where appropriate) and tested locally, i.e., for a chart with no data,

http://localhost:8088/api/v1/chart/<id>/data/?format=csv&type=post_processed&force=false
http://localhost:8088/api/v1/chart/<id>/data/?format=json&type=post_processed&force=false

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

data = query["data"]

if isinstance(data, str):
data = data.strip()
Copy link
Member Author

@john-bodley john-bodley Apr 5, 2023

Choose a reason for hiding this comment

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

Prevents the pandas.errors.EmptyDataError: No columns to parse from file error when query["data"] is \n—invoked via the/api/v1/chart/<pk>/data/?format=csv&type=post_processed endpoint.

@john-bodley john-bodley marked this pull request as ready for review April 5, 2023 08:59
@john-bodley john-bodley changed the title fix: Handling report + alerts with no data fix: Ensure the reporting framework handles charts with no data Apr 5, 2023
@codecov
Copy link

codecov bot commented Apr 5, 2023

Codecov Report

Merging #23585 (eb67fba) into master (9d2f43d) will decrease coverage by 1.63%.
The diff coverage is 70.58%.

❗ Current head eb67fba differs from pull request most recent head c5773f8. Consider uploading reports for the commit c5773f8 to get more accurate results

@@            Coverage Diff             @@
##           master   #23585      +/-   ##
==========================================
- Coverage   67.71%   66.09%   -1.63%     
==========================================
  Files        1916     1916              
  Lines       74014    74034      +20     
  Branches     8039     8040       +1     
==========================================
- Hits        50122    48934    -1188     
- Misses      21843    23052    +1209     
+ Partials     2049     2048       -1     
Flag Coverage Δ
hive 52.73% <0.00%> (-0.01%) ⬇️
mysql 78.48% <12.50%> (-0.02%) ⬇️
postgres 78.56% <12.50%> (-0.01%) ⬇️
presto 52.66% <0.00%> (-0.01%) ⬇️
python 79.04% <12.50%> (-3.37%) ⬇️
sqlite 77.07% <12.50%> (-0.01%) ⬇️
unit ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ackages/superset-ui-core/src/query/types/Filter.ts 100.00% <ø> (ø)
...tend/src/components/Chart/DrillBy/DrillByChart.tsx 100.00% <ø> (+7.14%) ⬆️
superset/charts/post_processing.py 12.14% <0.00%> (-77.64%) ⬇️
superset/utils/csv.py 96.66% <50.00%> (-1.61%) ⬇️
...tend/src/components/Chart/DrillBy/DrillByModal.tsx 86.66% <85.71%> (-5.00%) ⬇️
...re/controlUtils/getFormDataWithDashboardContext.ts 80.59% <100.00%> (+1.56%) ⬆️

... and 88 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@john-bodley john-bodley force-pushed the john-bodley--fix-report-schedule branch from 9d5953f to c5773f8 Compare April 5, 2023 10:19
@john-bodley john-bodley merged commit e8cfb31 into apache:master Apr 5, 2023
@john-bodley john-bodley deleted the john-bodley--fix-report-schedule branch April 5, 2023 19:31
john-bodley added a commit to airbnb/superset-fork that referenced this pull request Apr 5, 2023
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.0.0 labels Mar 13, 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/S 🚢 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants