Uh oh!
There was an error while loading. Please reload this page.
[SPARK-26321][SQL] Improve the behavior of sql text splitting for the spark-sql command line - #23276
[SPARK-26321][SQL] Improve the behavior of sql text splitting for the spark-sql command line #23276da-liii wants to merge 11 commits into
Conversation
Uh oh!
There was an error while loading. Please reload this page.
SparkQA
commented
Dec 10, 2018
Test build #99921 has finished for PR 23276 at commit
|
SparkQA
commented
Dec 10, 2018
Test build #99923 has finished for PR 23276 at commit
|
cloud-fan
commented
Dec 11, 2018
cc @gatorsmile |
SparkQA
commented
Dec 11, 2018
Test build #99965 has finished for PR 23276 at commit
|
da-liii
commented
Dec 11, 2018
The failed unit test works fine on my laptop. |
srowen
commented
Dec 11, 2018
Maybe this is obvious to you all, but what is the output, and what was expected here? |
da-liii
commented
Dec 11, 2018
OK I will add more desc. @srowen This is actually a trivial PR!Please review. |
SparkQA
commented
Dec 12, 2018
Test build #99999 has finished for PR 23276 at commit
|
gatorsmile
commented
Dec 12, 2018
Let us first update the PR description to explain the problem we want to resolve. Regarding comments, our SQL parser follows PostgreSQL. You can read SqlBase.g4 to confirm it. In PostgreSQL doc: https://www.postgresql.org/docs/9.4/sql-syntax-lexical.html
|
gatorsmile
commented
Dec 12, 2018
Thus, you need to consider both double quotes, single quotes. Also backstick, which is being used by Spark SQL for quoting identifiers. |
OK, I will polish it later. We are not using the BRACKETED_COMMENT. It seems to be a complicated task. I have to admit that I am ignorant of Antlr. Test cases mannually verified on spark.sql: |
da-liii
commented
Dec 24, 2018
@gatorsmile Please re-review. |
SparkQA
commented
Dec 24, 2018
Test build #100421 has finished for PR 23276 at commit
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
SparkQA
commented
Jan 3, 2019
Test build #100689 has finished for PR 23276 at commit
|
SparkQA
commented
Jan 3, 2019
Test build #100688 has finished for PR 23276 at commit
|
da-liii
commented
Jan 3, 2019
Rebased,still work in progress. |
da-liii
commented
Jan 7, 2019
@gatorsmile Please re-review. |
SparkQA
commented
Jan 7, 2019
Test build #100891 has finished for PR 23276 at commit
|
da-liii
commented
Jan 7, 2019
Jenkins ??? |
gatorsmile
commented
Jan 8, 2019
retest this please |
gatorsmile
commented
Jan 8, 2019
|
SparkQA
commented
Jan 8, 2019
Test build #100913 has finished for PR 23276 at commit
|
da-liii
commented
Jan 22, 2019
Rebase on the latest master with the newer Mockito. @gatorsmile Please review. |
SparkQA
commented
Jan 22, 2019
Test build #101536 has finished for PR 23276 at commit
|
da-liii
commented
Jan 26, 2019
@gatorsmile Conflicts resolved, please re-review. |
SparkQA
commented
Jan 26, 2019
Test build #101709 has finished for PR 23276 at commit
|
da-liii
commented
Jan 26, 2019
Manually tested, it works fine. |
HyukjinKwon
commented
Jan 27, 2019
retest this please |
SparkQA
commented
Jan 27, 2019
Test build #101727 has finished for PR 23276 at commit
|
| } | ||
| // method body imported from Hive and translated from Java to Scala | ||
| override def processLine(line: String, allowInterrupting: Boolean): Int = { |
There was a problem hiding this comment.
so the default processLine implementation doesn't handle ; well? do you mean hive sql shell have this bug as well?
There was a problem hiding this comment.
yes,there is a buggy impl in hive
There was a problem hiding this comment.
I checked the hive code and seems the ; is well handled at least in the master branch: https://github.com/apache/hive/blob/master/cli/src/java/org/apache/hadoop/hive/cli/CliDriver.java#L395
Do you mean only Hive 1.2 has this bug? Maybe we should upgrade hive.
There was a problem hiding this comment.
Yes,and I had not checked the impl on Hive master. We may judge which impl is better
There was a problem hiding this comment.
Upgrade the built-in Hive can fix this issue:
Another related issue:
https://issues.apache.org/jira/browse/SPARK-12014
| console.printInfo("Press Ctrl+C again to kill JVM") | ||
| // First, kill any running Spark jobs | ||
| // TODO |
There was a problem hiding this comment.
I think HiveInterruptUtils.interrupt() should be added here.
Because SparkSQLCLIDriver has invoke installSignalHandler() to add HiveInterruptCallback, which would cancel all spark jobs whenHiveInterruptUtils.interrupt() is invoked.
see
| // Hook up the custom Ctrl+C handler while processing this line | ||
| interruptSignal = new Signal("INT") | ||
| oldSignal = Signal.handle(interruptSignal, new SignalHandler() { | ||
| private val cliThread = Thread.currentThread() |
There was a problem hiding this comment.
what's the meaning of cliThread, I don't find any usage.
gatorsmile
commented
Jun 7, 2019
ping @sadhen Any update? |
AmplabJenkins
commented
Jun 29, 2019
Can one of the admins verify this patch? |
gatorsmile
commented
Jun 29, 2019
wangyum
commented
Jun 30, 2019
OK. Thank you @gatorsmile |
wangyum
commented
Jul 19, 2019
Create new PR: #25018 |
What changes were proposed in this pull request?
Improve the behavior of sql text splitting for the spark-sql command line.
Currently, the spark-sql command line does not split the sql text correctly, for example, the
;in double quotes.How was this patch tested?
Manually tested:
The expected result is
^;^. However, Spark master will split the SQL by;. As as result,select "^is not a valid SQL.Unit Tests:
TODO
Polish the code on SignalHandler. However, it should be another PR.