Adds a broker endpoint to validate query parsing without further validation/execution#17618
Open
saiswapnilar-stripe wants to merge 1 commit intoapache:masterfrom
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #17618 +/- ##
=========================================
Coverage 63.18% 63.18%
Complexity 1479 1479
=========================================
Files 3173 3173
Lines 189917 189944 +27
Branches 29064 29065 +1
=========================================
+ Hits 120002 120020 +18
- Misses 60575 60605 +30
+ Partials 9340 9319 -21
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #17615 , adding a broker API endpoint that parses a query string only for syntactic validation without further processing
Testing
Tested the endpoint by running valid/invalid queries
Valid query:
curl -X POST "localhost:8000/query/sql/validateSyntax" \ -H "Content-Type: application/json" \ -d '{"sql": "SELECT * FROM meetupRsvp LIMIT 10"}'Result:
{"errorCode":null,"validQuery":true,"errorMessage":null}Valid query (non existent table):
curl -X POST "localhost:8000/query/sql/validateSyntax" \ -H "Content-Type: application/json" \ -d '{"sql": "SELECT * FROM xyz LIMIT 10"}'Result:
{"errorCode":null,"validQuery":true,"errorMessage":null}Invalid query (reserved keyword):
curl -X POST "localhost:8000/query/sql/validateSyntax" \ -H "Content-Type: application/json" \ -d '{ "sql": "SELECT select FROM airlineStats a JOIN airports b ON a.destAirportCode = b.airportCode" }'Result:
{"errorCode":"SQL_PARSING","validQuery":false,"errorMessage":"Caught exception while parsing query: SELECT select FROM airlineStats a JOIN airports b ON a.destAirportCode = b.airportCode: Encountered \"\" at line 1, column 8.\nWas expecting one of:\n "}