-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-37906][SQL] spark-sql should not pass last comment to backend #35206
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
Closed
Conversation
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
Contributor
Author
|
ping @cloud-fan |
Contributor
|
is it possible to add a test? |
Contributor
Author
Added |
Contributor
Author
|
How about current? |
cloud-fan
reviewed
Jan 17, 2022
...e-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala
Outdated
Show resolved
Hide resolved
…/thriftserver/SparkSQLCLIDriver.scala Co-authored-by: Wenchen Fan <[email protected]>
Contributor
|
thanks, merging to master! |
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.
What changes were proposed in this pull request?
In #34815 we change back support unclosed bracketed comment to backend.
But miss the case such as
It's a common use case in sql job. We should ignore the comment at end of SQL script.
Need to clarify that when use
-e, we directly pass SQL tosplitSemiColon, when use-f, CliDriver will add a\nfor query.So in
splitSemiColon, we should consider both case.In this pr, the final behavior like below
For
-eSELECT 1; --commentSELECT 1and--commentto backend engine and throw exception since--commentcan't be executedSELECT 1to backend engine and will ignore the simple commentSELECT 1; /* comment */SELECT 1and/* comment */to backend engine and throw exception since/* comment */can't be executedSELECT 1to backend engineSELECT 1; /* commentSELECT 1and/* commentto backend engineSELECT 1and/* commentto backend engineSELECT 1; /* comment SELECT 1SELECT 1and/* comment SELECT 1to backend engineSELECT 1and/* comment SELECT 1to backend engine/ * comment SELECT 1;/ * comment SELECT 1;to back end engine and throwunclose bracketed comment exception/ * comment SELECT 1;to back end engine and throwunclose bracketed comment exceptionFor
-f, since-fwill add a\nat the end line if it's not started as--SELECT 1; --comment\nSELECT 1and--commentto backend engine and throw exception since--commentcan't be executedSELECT 1to backend engine and will ignore the simple commentSELECT 1; /* comment */ \nSELECT 1and/* comment */to backend engine and throw exception since/* comment */can't be executedSELECT 1to backend engineSELECT 1; /* comment \nSELECT 1and/* comment\nto backend engineSELECT 1and/* comment\nto backend engineSELECT 1; /* comment SELECT 1\nSELECT 1and/* comment SELECT 1\nto backend engineSELECT 1and/* comment SELECT 1\nto backend engine/ * comment SELECT 1;\n/ * comment SELECT 1;\nto back end engine and throwunclose bracketed comment exception/ * comment SELECT 1;\nto back end engine and throwunclose bracketed comment exceptionWhy are the changes needed?
Spark sql should not pass last entire comment to backend
Does this PR introduce any user-facing change?
Use can write SQL script end with a comment
How was this patch tested?
Added UT