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: contribution operator meets nan value #18782

Merged
merged 3 commits into from
Feb 18, 2022

Conversation

zhaoyongjie
Copy link
Member

SUMMARY

  1. fix: when NaN value in contribution operator can't calculate.
  2. add unit test to guarantee nan value in contribution.

closes: #18774

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

After

image

Before

image

TESTING INSTRUCTIONS

  1. Select birth_name as datasource
  2. Select Line Chart on explore page. notice that, use echart version of Line Chart
  3. Drag ds in x-axis
  4. Select sum(num_boys) in metrics
  5. Drag name in group by
  6. Select total in contribution mode
  7. You can look at a line chart as before screenshort.

ADDITIONAL INFORMATION

  • Has associated issue: 'Total' contribution mode for time series chart doesnt work #18774
  • 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

@codecov
Copy link

codecov bot commented Feb 17, 2022

Codecov Report

Merging #18782 (48c7006) into master (30a9d14) will decrease coverage by 0.16%.
The diff coverage is 100.00%.

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18782      +/-   ##
==========================================
- Coverage   66.32%   66.15%   -0.17%     
==========================================
  Files        1620     1620              
  Lines       63087    63092       +5     
  Branches     6372     6372              
==========================================
- Hits        41840    41738     -102     
- Misses      19590    19697     +107     
  Partials     1657     1657              
Flag Coverage Δ
hive ?
mysql 81.43% <100.00%> (+<0.01%) ⬆️
postgres 81.47% <100.00%> (+<0.01%) ⬆️
presto ?
python 81.56% <100.00%> (-0.35%) ⬇️
sqlite 81.16% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
superset/common/query_object.py 95.67% <100.00%> (+0.04%) ⬆️
...perset/utils/pandas_postprocessing/contribution.py 100.00% <100.00%> (ø)
superset/db_engines/hive.py 0.00% <0.00%> (-85.19%) ⬇️
superset/db_engine_specs/hive.py 70.27% <0.00%> (-15.45%) ⬇️
superset/db_engine_specs/presto.py 83.47% <0.00%> (-5.65%) ⬇️
superset/connectors/sqla/models.py 87.33% <0.00%> (-1.44%) ⬇️
superset/db_engine_specs/base.py 88.38% <0.00%> (-0.37%) ⬇️
superset/models/core.py 88.86% <0.00%> (-0.25%) ⬇️
superset/utils/core.py 90.15% <0.00%> (-0.13%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 30a9d14...f8e8f73. Read the comment docs.

Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

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

LGTM with a non-blocking comment to think about (as this PR fixes a clear bug I consider my comment mostly a nit). Also, an unrelated observation: I wonder if we should rename "Total" to something that describes more clearly that it's actually the "row" or "x-axis" that we're calculating the contribution for, not the "total", which I feel would be calculated in relation to the sum of the matrix.
image

superset/utils/pandas_postprocessing/contribution.py Outdated Show resolved Hide resolved
@zhaoyongjie
Copy link
Member Author

zhaoyongjie commented Feb 18, 2022

LGTM with a non-blocking comment to think about (as this PR fixes a clear bug I consider my comment mostly a nit). Also, an unrelated observation: I wonder if we should rename "Total" to something that describes more clearly that it's actually the "row" or "x-axis" that we're calculating the contribution for, not the "total", which I feel would be calculated in relation to the sum of the matrix. image

nice catch! done!

image

@zhaoyongjie zhaoyongjie merged commit 987740a into apache:master Feb 18, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.5.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/M 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'Total' contribution mode for time series chart doesnt work
3 participants