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: adhoc column in legacy chart #19234

Merged

Conversation

zhaoyongjie
Copy link
Member

@zhaoyongjie zhaoyongjie commented Mar 17, 2022

SUMMARY

Currently, If a chart applied Adhoc Column and it was a legacy chart without QueryContext in slice metadata, user will see an error on Dashboard: TypeError: unhashable type: 'dict'.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before

adhoc.column.before.mov

After

after.mov

TESTING INSTRUCTIONS

a) use following step to reproduce this issue

  1. open USA Births Names in examples dashboard.
  2. open Boy chart
  3. add or change a Adhoc Column on the chart, then save and overwrite.
  4. manually remove QueryContext for Boy chart from Superset metadata
    i) connect to Superset metadata by any database client or SQLLab
    ii) run SQL UPDATE slices set query_context=NULL WHERE slices.slice_name='Boys' in DB
  5. open USA Births Names, reproduced
  6. after this PR, will not see errors anymore

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

@zhaoyongjie zhaoyongjie requested a review from a team March 17, 2022 09:16
@codecov
Copy link

codecov bot commented Mar 17, 2022

Codecov Report

Merging #19234 (c78fc04) into master (cfb967f) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master   #19234      +/-   ##
==========================================
+ Coverage   66.73%   66.76%   +0.02%     
==========================================
  Files        1668     1670       +2     
  Lines       64271    64392     +121     
  Branches     6496     6496              
==========================================
+ Hits        42894    42992      +98     
- Misses      19695    19718      +23     
  Partials     1682     1682              
Flag Coverage Δ
hive 52.55% <0.00%> (-0.11%) ⬇️
mysql 81.96% <100.00%> (-0.01%) ⬇️
postgres 82.01% <100.00%> (-0.01%) ⬇️
presto 52.39% <0.00%> (-0.11%) ⬇️
python 82.43% <100.00%> (-0.01%) ⬇️
sqlite 81.76% <100.00%> (-0.01%) ⬇️

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

Impacted Files Coverage Δ
superset/connectors/base/models.py 88.61% <100.00%> (+0.03%) ⬆️
superset/datasets/api.py 88.28% <0.00%> (-3.61%) ⬇️
superset/views/sql_lab.py 59.33% <0.00%> (-1.36%) ⬇️
superset/dashboards/api.py 92.20% <0.00%> (-0.34%) ⬇️
superset/views/core.py 75.77% <0.00%> (-0.09%) ⬇️
superset/config.py 91.82% <0.00%> (-0.03%) ⬇️
superset/viz.py 58.26% <0.00%> (ø)
superset/databases/api.py 93.99% <0.00%> (ø)
superset/models/sql_lab.py 91.55% <0.00%> (ø)
superset/charts/data/api.py 89.80% <0.00%> (ø)
... and 11 more

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 cfb967f...c78fc04. Read the comment docs.

Copy link
Member

@ktmud ktmud 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 couple of nits

superset/connectors/base/models.py Show resolved Hide resolved
tests/integration_tests/model_tests.py Show resolved Hide resolved
@zhaoyongjie zhaoyongjie force-pushed the fix_adhoc_column_in_legacychart branch from 3f69679 to ee1dd3a Compare March 18, 2022 04:27
Copy link
Member

@ktmud ktmud left a comment

Choose a reason for hiding this comment

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

The updates LGTM.

Not super necessary, but if you can link to the code path that raises the error in the PR description, that'd be great.

@zhaoyongjie
Copy link
Member Author

The updates LGTM.

Not super necessary, but if you can link to the code path that raises the error in the PR description, that'd be great.

This issue is in the Preset' Shortcut. So I can't link.

@zhaoyongjie zhaoyongjie merged commit b5e9fad into apache:master Mar 18, 2022
@sadpandajoe
Copy link
Member

🏷️ preset:2022.11

sadpandajoe pushed a commit to preset-io/superset that referenced this pull request Mar 18, 2022
villebro pushed a commit that referenced this pull request Apr 3, 2022
@mistercrunch mistercrunch added 🍒 1.5.0 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.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 lts-v1 preset:2022.11 size/M 🍒 1.5.0 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants