Skip to content

Commit

Permalink
[SPARK-20120][SQL] spark-sql support silent mode
Browse files Browse the repository at this point in the history
## What changes were proposed in this pull request?

It is similar to Hive silent mode, just show the query result. see: [Hive LanguageManual+Cli](https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Cli) and [the implementation of Hive silent mode](https://github.com/apache/hive/blob/release-1.2.1/ql/src/java/org/apache/hadoop/hive/ql/session/SessionState.java#L948-L950).

This PR set the Logger level to `WARN` to get similar result.

## How was this patch tested?

manual tests

![manual test spark sql silent mode](https://cloud.githubusercontent.com/assets/5399861/24390165/989b7780-13b9-11e7-8496-6e68f55757e3.gif)

Author: Yuming Wang <[email protected]>

Closes #17449 from wangyum/SPARK-20120.
  • Loading branch information
wangyum authored and gatorsmile committed Mar 29, 2017
1 parent 5c8ef37 commit fe1d6b0
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import org.apache.hadoop.hive.ql.Driver
import org.apache.hadoop.hive.ql.exec.Utilities
import org.apache.hadoop.hive.ql.processors._
import org.apache.hadoop.hive.ql.session.SessionState
import org.apache.log4j.{Level, Logger}
import org.apache.thrift.transport.TSocket

import org.apache.spark.internal.Logging
Expand Down Expand Up @@ -275,6 +276,10 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging {

private val console = new SessionState.LogHelper(LOG)

if (sessionState.getIsSilent) {
Logger.getRootLogger.setLevel(Level.WARN)
}

private val isRemoteMode = {
SparkSQLCLIDriver.isRemoteMode(sessionState)
}
Expand Down

0 comments on commit fe1d6b0

Please sign in to comment.