yaooqinn commented on code in PR #40036:
URL: https://github.com/apache/spark/pull/40036#discussion_r1111674186
##########
sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala:
##########
@@ -278,8 +278,16 @@ private[hive] object SparkSQLCLIDriver extends Logging {
var ret = 0
var prefix = ""
- val currentDB = ReflectionUtils.invokeStatic(classOf[CliDriver],
"getFormattedDb",
- classOf[HiveConf] -> conf, classOf[CliSessionState] -> sessionState)
+
+ def currentDB: String = {
+ val printCurrentDb =
conf.getBoolVar(HiveConf.ConfVars.CLIPRINTCURRENTDB) ||
+ SparkSQLEnv.sqlContext.conf.cliPrintCurrentDb
+ if (printCurrentDb) {
+ s" (${SparkSQLEnv.sqlContext.sparkSession.catalog.currentDatabase})"
+ } else {
+ ""
Review Comment:
do you mean
```scala
if (SparkSQLEnv.sqlContext.conf.cliPrintCurrentDb) {
s" (${SparkSQLEnv.sqlContext.sparkSession.catalog.currentDatabase})"
} else {
ReflectionUtils.invokeStatic(classOf[CliDriver], "getFormattedDb",...
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]