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
fix(chart-data-api): case insensitive evaluation of filter op #10299
Conversation
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.
Looks good, would be nice a add a test for the REST API itself on tests/charts/api_tests.py
superset/utils/schema.py
Outdated
|
||
def __call__(self, value: Any) -> str: | ||
try: | ||
print(value) |
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.
print here is probably a debug left over
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
* 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
…#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
…#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
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
AFTER
TEST PLAN
CI + new tests
ADDITIONAL INFORMATION