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(chart-data-api): case insensitive evaluation of filter op #10299

Merged
merged 5 commits into from Jul 13, 2020

Conversation

villebro
Copy link
Member

@villebro villebro commented Jul 13, 2020

SUMMARY

Introduce case insensitive validation of filter operators in chart data schemas, as filter operators are made uppercase in both Druid and SQLA connectors, hence case isn't a concern for queries. The custom validators are moved to utils/schema.py as they will likely be relevant in other endpoints, too.

Currently the cases of filter operators are inconsistent: some are all uppercase, others all lowercase. I considered unifying those, but it would have introduced risk of regression, so will save that for a separate PR after 0.37.0 has shipped.

BEFORE

image

AFTER

image

TEST PLAN

CI + new tests

ADDITIONAL INFORMATION

@villebro villebro requested a review from dpgaspar July 13, 2020 08:47
@villebro villebro changed the title Villebro/schema case insensitive fix(chart-data-api): case insensitive evaluation of filter op Jul 13, 2020
Copy link
Member

@dpgaspar dpgaspar left a comment

Choose a reason for hiding this comment

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

Looks good, would be nice a add a test for the REST API itself on tests/charts/api_tests.py


def __call__(self, value: Any) -> str:
try:
print(value)
Copy link
Member

Choose a reason for hiding this comment

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

print here is probably a debug left over

@codecov-commenter
Copy link

codecov-commenter commented Jul 13, 2020

Codecov Report

Merging #10299 into master will increase coverage by 0.20%.
The diff coverage is 95.45%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #10299      +/-   ##
==========================================
+ Coverage   70.42%   70.63%   +0.20%     
==========================================
  Files         599      600       +1     
  Lines       32067    32102      +35     
  Branches     3244     3244              
==========================================
+ Hits        22583    22675      +92     
+ Misses       9380     9325      -55     
+ Partials      104      102       -2     
Flag Coverage Δ
#cypress 55.62% <ø> (+0.14%) ⬆️
#javascript 59.57% <ø> (ø)
#python 69.75% <95.45%> (+0.25%) ⬆️
Impacted Files Coverage Δ
superset/utils/schema.py 94.11% <94.11%> (ø)
superset/charts/schemas.py 100.00% <100.00%> (ø)
...perset-frontend/src/messageToasts/actions/index.js 91.66% <0.00%> (-8.34%) ⬇️
...et-frontend/src/messageToasts/components/Toast.tsx 96.87% <0.00%> (-3.13%) ⬇️
superset/errors.py 100.00% <0.00%> (ø)
superset/viz_sip38.py 0.00% <0.00%> (ø)
superset/sql_parse.py 99.31% <0.00%> (+<0.01%) ⬆️
superset/charts/api.py 73.27% <0.00%> (+0.11%) ⬆️
... and 15 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 93753cf...0db52ef. Read the comment docs.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Jul 13, 2020
@villebro villebro requested a review from dpgaspar July 13, 2020 13:14
@villebro villebro merged commit b316f72 into apache:master Jul 13, 2020
@villebro villebro deleted the villebro/schema-case-insensitive branch July 13, 2020 14:21
@villebro villebro added the v0.37 label Jul 13, 2020
villebro added a commit that referenced this pull request Jul 14, 2020
* fix(chart-data-api): case insensitive evaluation of filter op

* fix(chart-data-api): case insensitive evaluation of filter op

* mypy

* remove print statement

* add test
auxten pushed a commit to auxten/incubator-superset that referenced this pull request Nov 20, 2020
…#10299)

* fix(chart-data-api): case insensitive evaluation of filter op

* fix(chart-data-api): case insensitive evaluation of filter op

* mypy

* remove print statement

* add test
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
…#10299)

* fix(chart-data-api): case insensitive evaluation of filter op

* fix(chart-data-api): case insensitive evaluation of filter op

* mypy

* remove print statement

* add test
@mistercrunch mistercrunch added 🍒 0.37.0 🍒 0.37.1 🍒 0.37.2 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.38.0 labels Mar 12, 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/L v0.37 🍒 0.37.0 🍒 0.37.1 🍒 0.37.2 🚢 0.38.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Word cloud chart throws an error with an "in" filter clause specified
4 participants