-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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(pvt2): migrations from legacy pivot table error when form_data have pieces of pvt2 #24710
fix(pvt2): migrations from legacy pivot table error when form_data have pieces of pvt2 #24710
Conversation
…ve pieces of pvt2
Codecov Report
@@ Coverage Diff @@
## master #24710 +/- ##
==========================================
+ Coverage 58.35% 67.04% +8.69%
==========================================
Files 1901 1901
Lines 73933 73936 +3
Branches 8183 8183
==========================================
+ Hits 43146 49573 +6427
+ Misses 28666 22242 -6424
Partials 2121 2121
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 347 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Thanks for the fix @Always-prog! If this behavior happens for Pivot Table, it may also happen for other chart types. Would you mind resolving this in a more global way? You can skip rename keys in
|
Then, can we just instead of an error "Duplicate key in target viz" just skip keys which is in rename dictionary? |
No because that check is to prevent that different pieces of information are mapped to the same key which is a development error. |
@michael-s-molina I moved removing rename keys from data to the base.py, but before |
@@ -64,6 +64,12 @@ def _migrate(self) -> None: | |||
if "viz_type" in self.data: | |||
self.data["viz_type"] = self.target_viz_type | |||
|
|||
# Sometimes visualizations have same keys in the source form_data and rename_keys | |||
# We need to remove them from data to allow the migration to work properly with rename_keys | |||
for key in self.rename_keys.values(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm worried we might have keys that belong to the new version but not a corresponding legacy key. In that case, removing the keys will make us lose information. Taking a Pivot Table as example, we might have series_limit
(new) but no row_limit
(legacy). For safety, could we only remove keys if its legacy counterpart also exists?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it! I added removing target key only if source and target rename keys exists in form_data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you for the fix @Always-prog!
@michael-s-molina Hi! If everything is ok with my PR now, can we merge it? |
Hey. Could you rebase it to fix the Docker issue? I can't merge it with that CI check failing. |
@michael-s-molina There is no need to rebase or merge (I already tried). I created a branch on the latest version of the code. |
You need to have #24731 in your commit history to fix the CI error. That's why a rebase is needed. |
…ve pieces of pvt2
…TechAuditBI/superset into fix/migration-pivot-table-error
@michael-s-molina Got it, thank you. Fixed! |
…ve pieces of pvt2 (apache#24710)
SUMMARY
Hello!
Migration from legacy pivot table v2 sometimes returns an error due to pieces of Pivot Table V2 form_data in the legacy pivot. This PR fixes it. Pieces of form_data can occur when users switch from pvt2 tables to legacy pivot.
TESTING INSTRUCTIONS
Or just try to migrate form_data that is already generated by me and see the error.
ADDITIONAL INFORMATION