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

Update sql validator status #8799

Merged
merged 4 commits into from
Dec 10, 2019
Merged

Conversation

khtruong
Copy link
Contributor

CATEGORY

Choose one

  • Bug Fix
  • Enhancement (new features, refinement)
  • Refactor
  • Add tests
  • Build / Development Environment
  • Documentation

SUMMARY

The Presto SQL validator does not always return a message and error location. Sometimes we only get a message. If it is an explicit message from the validator, return it and set its error location as the beginning of the string. Otherwise, return it as a general error as a 400 if the message explicitly says it is a 4xx error.

TEST PLAN

Tested manually

REVIEWERS

@betodealmeida @DiggidyDave

@codecov-io
Copy link

codecov-io commented Dec 10, 2019

Codecov Report

Merging #8799 into master will increase coverage by 0.04%.
The diff coverage is 57.14%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #8799      +/-   ##
=========================================
+ Coverage   65.85%   65.9%   +0.04%     
=========================================
  Files         482     482              
  Lines       24152   24162      +10     
  Branches     2770    2770              
=========================================
+ Hits        15906   15924      +18     
+ Misses       8068    8060       -8     
  Partials      178     178
Impacted Files Coverage Δ
superset/sql_validators/presto_db.py 82.43% <50%> (-2.08%) ⬇️
superset/views/core.py 72.13% <66.66%> (+0.27%) ⬆️
superset/views/base.py 74.74% <0%> (ø) ⬆️
superset/models/sql_lab.py 91.89% <0%> (+0.9%) ⬆️
superset/extensions.py 96.15% <0%> (+1.28%) ⬆️
superset/views/sql_lab.py 60.52% <0%> (+3.94%) ⬆️

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 8a00168...133a799. Read the comment docs.

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.

LGTM, just a couple comments.

# If we have a message but no error location, return the message and
# set the location as the beginning.
return SQLValidationAnnotation(
message=message, line_number=1, start_column=1, end_column=1
Copy link
Member

Choose a reason for hiding this comment

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

Is this 1-indexed or 0-indexed? (I assume 1 since it's Presto, just checking.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

1-indexed like you assumed

f"{validator.name} was unable to check your query.\nPlease "
"make sure that any services it depends on are available\n"
f"{validator.name} was unable to check your query.\n"
"Please recheck your query.\n"
Copy link
Member

Choose a reason for hiding this comment

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

Do we know why the validator is unable to check the query? Is this is something the user can fix? Seems to me that there's nothing the user can do, and the validator should be doing the work of checking the query, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is hard to say. The examples I saw were actually checked by the validator and this PR addresses those cases. So I hope that this will catch issues with our code instead of the validator because you are right that there isn't anything the user can do. I was going to check the logs once this PR was checked in and deployed to see if there were other cases I missed.

@khtruong khtruong merged commit 6c130b3 into apache:master Dec 10, 2019
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 0.36.0 labels Feb 28, 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/S 🚢 0.36.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants