Skip to content

Commit 9b2e0d6

Browse files
AngersZhuuuuwangyum
authored andcommitted
[SPARK-35086][SQL][CORE] --verbose should be passed to Spark SQL CLI too
### What changes were proposed in this pull request? In current code, if we run spark sql with ``` ./bin/spark-sql --verbose ``` It won't be passed to end SparkSQLCliDriver, then the SessionState won't call `setIsVerbose` In the CLI option, it shows ``` CLI options: -v,--verbose Verbose mode (echo executed SQL to the console) ``` It's not consistent. This pr fix this issue ### Why are the changes needed? Fix bug ### Does this PR introduce _any_ user-facing change? when user call `-v` when run spark sql, sql will be echoed to console. ### How was this patch tested? Added UT Closes apache#32163 from AngersZhuuuu/SPARK-35086. Authored-by: Angerszhuuuu <angers.zhu@gmail.com> Signed-off-by: Yuming Wang <yumwang@ebay.com>
1 parent 271aa33 commit 9b2e0d6

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

core/src/main/scala/org/apache/spark/deploy/SparkSubmit.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,9 @@ private[spark] class SparkSubmit extends Logging {
852852
}
853853
sparkConf.set(SUBMIT_PYTHON_FILES, formattedPyFiles.split(",").toSeq)
854854

855+
if (args.verbose) {
856+
childArgs ++= Seq("--verbose")
857+
}
855858
(childArgs.toSeq, childClasspath.toSeq, sparkConf, childMainClass)
856859
}
857860

sql/hive-thriftserver/src/test/scala/org/apache/spark/sql/hive/thriftserver/CliSuite.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,4 +594,11 @@ class CliSuite extends SparkFunSuite with BeforeAndAfterAll with Logging {
594594
-> "BroadcastHashJoin"
595595
)
596596
}
597+
598+
test("SPARK-35086: --verbose should be passed to Spark SQL CLI") {
599+
runCliWithin(2.minute, Seq("--verbose"))(
600+
"SELECT 'SPARK-35086' AS c1, '--verbose' AS c2;" ->
601+
"SELECT 'SPARK-35086' AS c1, '--verbose' AS c2"
602+
)
603+
}
597604
}

0 commit comments

Comments
 (0)