Skip to content

feat: TreeMap migration - #20346

Merged
zhaoyongjie merged 3 commits into
apache:masterfrom
zhaoyongjie:feat/migrate_treemap
Jul 7, 2022
Merged

zhaoyongjie merged 3 commits into
apache:masterfrom
zhaoyongjie:feat/migrate_treemap

Conversation

@zhaoyongjie

Copy link
Copy Markdown
Member

SUMMARY

This PR intends to introduce an approach that migrates from v1 viz to v2 viz. The first PR implement TreeMap migration.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A

TESTING INSTRUCTIONS

# upgrade
superset db upgrade

# downgrade
superset db downgrade

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 as a code owner June 10, 2022 07:46
Comment thread superset/utils/migrate_viz.py Resolved
Comment on lines 17 to 22

@zhaoyongjie zhaoyongjie Jun 10, 2022 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

bycatch: pretty output

image

@codecov

codecov Bot commented Jun 10, 2022 •

Copy link
Copy Markdown

Codecov Report

Merging #20346 (0aa273e) into master (90d486a) will decrease coverage by 0.03%.
The diff coverage is 69.47%.

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

@@            Coverage Diff             @@
##           master   #20346      +/-   ##
==========================================
- Coverage   66.71%   66.68%   -0.04%     
==========================================
  Files        1752     1753       +1     
  Lines       65478    65710     +232     
  Branches     6916     6940      +24     
==========================================
+ Hits        43681    43816     +135     
- Misses      20049    20132      +83     
- Partials     1748     1762      +14     
Flag Coverage Δ
mysql 82.41% <96.27%> (+0.04%) ⬆️
postgres 82.48% <96.27%> (+0.04%) ⬆️
presto ?
python 82.56% <96.27%> (-0.09%) ⬇️
sqlite 82.27% <96.27%> (+0.04%) ⬆️
unit ?

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

Impacted Files Coverage Δ
...t-ui-chart-controls/src/operators/pivotOperator.ts 100.00% <ø> (ø)
...controls/src/operators/timeComparePivotOperator.ts 100.00% <ø> (ø)
...t-controls/src/sections/echartsTimeSeriesQuery.tsx 50.00% <ø> (ø)
...d/packages/superset-ui-chart-controls/src/types.ts 100.00% <ø> (ø)
...superset-ui-core/src/query/types/PostProcessing.ts 100.00% <ø> (ø)
...egacy-preset-chart-deckgl/src/layers/Grid/Grid.jsx 0.00% <0.00%> (ø)
...reset-chart-deckgl/src/layers/Grid/controlPanel.ts 50.00% <0.00%> (-50.00%) ⬇️
.../legacy-preset-chart-deckgl/src/layers/Hex/Hex.jsx 0.00% <0.00%> (ø)
...preset-chart-deckgl/src/layers/Hex/controlPanel.ts 50.00% <0.00%> (-50.00%) ⬇️
...et-chart-deckgl/src/layers/Polygon/controlPanel.ts 33.33% <0.00%> (-16.67%) ⬇️
... and 89 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 90d486a...b1d10bd. Read the comment docs.

Comment thread tests/unit_tests/conftest.py Outdated
Comment on lines 71 to 75

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Use integration test database instance for local debugging.

@zhaoyongjie
zhaoyongjie requested review from a team and rusackas June 10, 2022 12:15
@zhaoyongjie
zhaoyongjie force-pushed the feat/migrate_treemap branch 3 times, most recently from 7b4e0dc to 9e44fa0 Compare June 13, 2022 07:00
@zhaoyongjie zhaoyongjie mentioned this pull request Jun 13, 2022
1 of 9 tasks
@zhaoyongjie zhaoyongjie reopened this Jun 13, 2022

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe have separated tests for upgrade and downgrade?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

the method of downgrade needs an updated slice so combine upgrade and downgrade in the same unit test case.

Comment thread superset/utils/migrate_viz.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe move MigrateTreeMap to its own file? I guess we'll have a bunch of these.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is a one-time script. There is no need to split moudles.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Won't we have other viz types to be migrated? If yes, are you going to add all the viz types to this file?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yep, all migrations are placed in this script.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Generally, scripts are waterfalls, while libary should be modular.

Comment thread superset/utils/migrate_viz.py Outdated
Comment on lines 57 to 61

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I personally find this more readable, but it's not a blocker.

Suggested change
if key in self.mapping_keys and self.mapping_keys[key] in rv_data:
raise ValueError("Duplicate key in target viz")
if key in self.mapping_keys:
rv_data[self.mapping_keys[key]] = value
if key in self.mapping_keys:
mapped_key = self.mapping_keys[key]
if mapped_key in rv_data:
raise ValueError("Duplicate key in target viz")
rv_data[mapped_key] = value

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Exception handling is easier to maintain if it can be put together.

@zhaoyongjie
zhaoyongjie requested review from a team and betodealmeida June 21, 2022 07:19
@zhaoyongjie
zhaoyongjie force-pushed the feat/migrate_treemap branch from b2daecf to 0d10fb3 Compare June 30, 2022 02:38
@michael-s-molina

Copy link
Copy Markdown
Member

@zhaoyongjie @rusackas Shouldn't we disable TreeMap v1 after the migration? By that, I mean no more TreeMap v1 on Add Slice and Chart Type filter in the charts list. Right now, the user can still create the old version which kind of defeats the whole purpose of the migration.

@zhaoyongjie

zhaoyongjie commented Jul 6, 2022 •

Copy link
Copy Markdown
Member Author

@zhaoyongjie @rusackas Shouldn't we disable TreeMap v1 after the migration? By that, I mean no more TreeMap v1 on Add Slice and Chart Type filter in the charts list. Right now, the user can still create the old version which kind of defeats the whole purpose of the migration.

I intend to do a separated PR that removes the Legacy TreeMap after merged migration PR. the follow-up PR will 1) remove Legacy TreeMap from plugins, 2) remove legacy TreeMap from MainPresent.js.

@michael-s-molina

michael-s-molina commented Jul 6, 2022 •

Copy link
Copy Markdown
Member

@zhaoyongjie @rusackas Shouldn't we disable TreeMap v1 after the migration? By that, I mean no more TreeMap v1 on Add Slice and Chart Type filter in the charts list. Right now, the user can still create the old version which kind of defeats the whole purpose of the migration.

I intend to do a separated PR that removes the Legacy TreeMap after merged migration PR. the follow-up PR will 1) remove Legacy TreeMap from plugins, 2) remove legacy TreeMap from MainPresent.js.

May I suggest implementing this in the same PR to avoid the risk of someone executing the script and creating an old TreeMap before the follow-up PR is merged?

@rusackas
rusackas requested a review from john-bodley July 6, 2022 16:09
Comment thread superset/utils/migrate_viz.py Resolved
Comment thread superset/utils/migrate_viz.py Resolved
Comment thread superset/utils/migrate_viz.py Resolved
Comment thread superset/utils/migrate_viz.py Resolved
@zhaoyongjie

Copy link
Copy Markdown
Member Author

@john-bodley thanks for the reviewing, I have addressed comments.

@zhaoyongjie
zhaoyongjie merged commit 7626c31 into apache:master Jul 7, 2022
akshatsri pushed a commit to charan1314/superset that referenced this pull request Jul 19, 2022
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 First shipped in 2.1.0 labels Mar 13, 2024
qfcwell pushed a commit to qfcwell/superset that referenced this pull request May 12, 2026
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 🚢 2.1.0 First shipped in 2.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants