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(QueryContext): move df methods utils to utils package #17496

Merged
merged 3 commits into from
Nov 21, 2021

Conversation

ofekisr
Copy link
Contributor

@ofekisr ofekisr commented Nov 21, 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 Eleventh PR in a sequence of PRs to meet these
The next PR is #17497

PR description

QueryContext class contains static methods used as Dataframe utils. To meet SRP, those methods moved to a utils package.

to keep the utils meeting SRP, it implies arranging the utils to be as package and separating each of the related methods into ad hoc modules.

Test plans

There is no logic added 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
  6. refactor(ChartDataCommand): remove create queryContext command's responsibly  #17461
  7. refactor(QueryObject): decouple from queryContext and clean code #17465
  8. refactor(QueryObject): add QueryObjectFactory to meet SRP #17466
  9. refactor(QueryObject): decouple from superset #17479
  10. refactor(QueryContext): add QueryContextFactory to meet SRP #17495

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.

simple move

@codecov
Copy link

codecov bot commented Nov 21, 2021

Codecov Report

Merging #17496 (0227ba5) into master (8a6ecd3) will decrease coverage by 0.13%.
The diff coverage is 94.73%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17496      +/-   ##
==========================================
- Coverage   76.90%   76.76%   -0.14%     
==========================================
  Files        1044     1045       +1     
  Lines       56435    56441       +6     
  Branches     7798     7798              
==========================================
- Hits        43399    43327      -72     
- Misses      12780    12858      +78     
  Partials      256      256              
Flag Coverage Δ
hive ?
mysql 81.97% <94.73%> (+<0.01%) ⬆️
postgres 81.98% <94.73%> (+<0.01%) ⬆️
python 82.07% <94.73%> (-0.27%) ⬇️
sqlite 81.66% <89.47%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
superset/common/utils/dataframe_utils.py 92.85% <92.85%> (ø)
superset/common/query_context.py 91.03% <100.00%> (-0.37%) ⬇️
superset/common/utils/query_cache_manager.py 89.41% <100.00%> (ø)
superset/db_engines/hive.py 0.00% <0.00%> (-85.19%) ⬇️
superset/db_engine_specs/hive.py 69.49% <0.00%> (-16.99%) ⬇️
superset/views/database/mixins.py 81.03% <0.00%> (-1.73%) ⬇️
superset/db_engine_specs/presto.py 83.47% <0.00%> (-0.84%) ⬇️
superset/db_engine_specs/base.py 88.20% <0.00%> (-0.39%) ⬇️
superset/connectors/sqla/models.py 86.79% <0.00%> (-0.23%) ⬇️
superset/utils/core.py 89.61% <0.00%> (-0.12%) ⬇️

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 8a6ecd3...0227ba5. Read the comment docs.

@amitmiran137 amitmiran137 merged commit 4b7d06c into apache:master Nov 21, 2021
@amitmiran137 amitmiran137 deleted the refactor/chart_data_flows_11 branch November 21, 2021 14:13
AAfghahi pushed a commit that referenced this pull request Jan 10, 2022
* chore(common.utils): modified utils from module based to package based

* refactor(common.utils): move QueryCacheManager to ad-hoc module

* refactor(QueryContext): move df method utils to utils module
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.5.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 size/M 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants