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(migrations): Fix the time comparison migration #30029

Merged

Conversation

Antonio-RiveroMartnez
Copy link
Member

SUMMARY

After the initial version of the time comparison feature for Table and Big Number we introduced a migration to upgrade old charts to the new comparison controls, however, during that upgrade a table that never had comparison in it was wrongly showing Time Comparison Data.

This PR is fixing the migration so we can properly upgrade such old tables if needed, also we extend our tests to not only consider charts that have the enabled_time_comparison flag set to True.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

BEFORE

Old version of Chart using Time Comparison once but then removing it from the controls:
initial
removed

The old Chart is upgraded with the previous version of the migration:
upgrade

The chart start showing comparison data:
wrong

AFTER

Old version of Chart using Time Comparison once but then removing it from the controls:
v2_initial
v2_no_comp

The old Chart is upgraded with the new version of the migration:
v2_upgrade

The chart doesn't show comparison data:
correct

TESTING INSTRUCTIONS

  1. Create a table chart with a version of the time comparison where Enable Time Comparison checkbox was used
  2. Run a comparison data (Mark the checkbox and select a time range)
  3. Unmark the checkbox and run the chart data again so your chart has no longer comparison info
  4. Use more updated version and run the migrations so your table is upgraded
  5. You must not see time comparison data in the table.

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

@github-actions github-actions bot added the risk:db-migration PRs that require a DB migration label Aug 27, 2024
@dosubot dosubot bot added the change:backend Requires changing the backend label Aug 27, 2024
Copy link

codecov bot commented Aug 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.68%. Comparing base (76d897e) to head (e349e28).
Report is 637 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #30029       +/-   ##
===========================================
+ Coverage   60.48%   83.68%   +23.20%     
===========================================
  Files        1931      528     -1403     
  Lines       76236    38207    -38029     
  Branches     8568        0     -8568     
===========================================
- Hits        46114    31975    -14139     
+ Misses      28017     6232    -21785     
+ Partials     2105        0     -2105     
Flag Coverage Δ
hive 48.92% <ø> (-0.24%) ⬇️
javascript ?
mysql 76.77% <ø> (?)
postgres 76.84% <ø> (?)
presto 53.48% <ø> (-0.32%) ⬇️
python 83.68% <ø> (+20.20%) ⬆️
sqlite 76.31% <ø> (?)
unit 60.29% <ø> (+2.66%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@michael-s-molina michael-s-molina added the review:checkpoint Last PR reviewed during the daily review standup label Aug 27, 2024
Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

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

Thanks for fixing this!

@@ -161,6 +161,70 @@
}
],
}
params_v1_other_than_custom_false: dict[str, Any] = {
Copy link
Member

@michael-s-molina michael-s-molina Aug 27, 2024

Choose a reason for hiding this comment

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

Would you mind extracting the common parts between params_v1_with_custom, params_v1_other_than_custom_false, params_v2_with_custom, params_v2_other_than_custom, params_v2_other_than_custom_false and just override the necessary properties for each variable to avoid code duplication and increase readability?

Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

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

Thanks for addressing the comments @Antonio-RiveroMartnez!

@Antonio-RiveroMartnez Antonio-RiveroMartnez merged commit d80f23e into apache:master Aug 27, 2024
38 checks passed
@sadpandajoe sadpandajoe added the v4.1 Label added by the release manager to track PRs to be included in the 4.1 branch label Aug 27, 2024
sadpandajoe pushed a commit that referenced this pull request Aug 27, 2024
@michael-s-molina michael-s-molina removed the review:checkpoint Last PR reviewed during the daily review standup label Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change:backend Requires changing the backend risk:db-migration PRs that require a DB migration size/L v4.1 Label added by the release manager to track PRs to be included in the 4.1 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants