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

refactor(ChartDataCommand): remove create queryContext command's responsibly #17461

Merged
merged 1 commit into from
Nov 17, 2021

Conversation

ofekisr
Copy link
Contributor

@ofekisr ofekisr commented Nov 17, 2021

Background

When we have worked on #16991 we wanted to test the new functionalities in concrete and accurate unittest.
All chartData flows and its components are too couple to superset so it is impossible to create unittests.
The flows are not testable and so many components do not meet the very important principle SRP and the code became so dirty

So I've started to refactor it (#17344 ) but many changes were added and it was hard to review so I decided to split those changes into small PRs so will be easier to follow

This is the sixth PR in a sequence of PRs to meet these
The next PR is #17465

PR description

move create queryContext command's responsibility to the command clients (ChartDataRestApi and load_chart_data_into_cache celery task) to achieve meeting the SRP

Note - moving it to the view layer is an anti-pattern but remember, the refactor is combination of many PRs, so it'll be changed in one of the next PRs
Note 2 - the more optimal design is to encapsulate it under an ad-hoc object or keep refactoring the CommandaData into three separated commands

Test plans

There are no logic changes, only calling ordering so new tests are not required

Previous PRs

  1. refactor(ChartData): move ChartDataResult enums to common #17399
  2. refactor(ChartData): move chart_data_apis from ChartRestApi ChartDataRestApi #17400
  3. refactor(ChartDataCommand): separate loading query_context form cache into different module #17405
  4. refactor(TestChartApi): move chart data api tests into TestChartDataApi #17407
  5. refactor(ChartDataCommand): into two separate commands #17425

Copy link
Member

@amitmiran137 amitmiran137 left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Nov 17, 2021

Codecov Report

Merging #17461 (e56fa3a) into master (c54027a) will decrease coverage by 0.22%.
The diff coverage is 78.12%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17461      +/-   ##
==========================================
- Coverage   76.94%   76.72%   -0.23%     
==========================================
  Files        1042     1042              
  Lines       56299    56312      +13     
  Branches     7793     7793              
==========================================
- Hits        43322    43208     -114     
- Misses      12721    12848     +127     
  Partials      256      256              
Flag Coverage Δ
hive ?
mysql 81.94% <78.12%> (-0.02%) ⬇️
postgres 81.95% <78.12%> (-0.02%) ⬇️
presto ?
python 82.03% <78.12%> (-0.43%) ⬇️
sqlite 81.63% <78.12%> (-0.02%) ⬇️

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

Impacted Files Coverage Δ
superset/tasks/async_queries.py 91.02% <66.66%> (-5.95%) ⬇️
superset/charts/data/api.py 87.91% <86.66%> (-0.66%) ⬇️
superset/charts/data/commands.py 100.00% <100.00%> (+2.12%) ⬆️
superset/db_engines/hive.py 0.00% <0.00%> (-85.19%) ⬇️
superset/db_engine_specs/hive.py 69.49% <0.00%> (-16.99%) ⬇️
superset/db_engine_specs/presto.py 83.47% <0.00%> (-6.91%) ⬇️
superset/views/database/mixins.py 81.03% <0.00%> (-1.73%) ⬇️
superset/connectors/sqla/models.py 86.79% <0.00%> (-1.59%) ⬇️
superset/models/core.py 89.26% <0.00%> (-0.74%) ⬇️
superset/db_engine_specs/base.py 88.20% <0.00%> (-0.39%) ⬇️
... and 1 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 c54027a...e56fa3a. Read the comment docs.

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.

3 participants