diff options
author | OopsOutOfMemory <victorshengli@126.com> | 2015-02-16 12:34:09 -0800 |
---|---|---|
committer | Michael Armbrust <michael@databricks.com> | 2015-02-16 12:34:09 -0800 |
commit | b4d7c7032d755de42951f92d9535287ef6230b9b (patch) | |
tree | 0fecc15c273585ef6eab80717321db6e1b3a1d17 /sql/hive-thriftserver/src/main | |
parent | 104b2c45805ce0a9c86e2823f402de6e9f0aee81 (diff) | |
download | spark-b4d7c7032d755de42951f92d9535287ef6230b9b.tar.gz spark-b4d7c7032d755de42951f92d9535287ef6230b9b.tar.bz2 spark-b4d7c7032d755de42951f92d9535287ef6230b9b.zip |
[SQL] Add fetched row count in SparkSQLCLIDriver
before this change:
```scala
Time taken: 0.619 seconds
```
after this change :
```scala
Time taken: 0.619 seconds, Fetched: 4 row(s)
```
Author: OopsOutOfMemory <victorshengli@126.com>
Closes #4604 from OopsOutOfMemory/rowcount and squashes the following commits:
7252dea [OopsOutOfMemory] add fetched row count
Diffstat (limited to 'sql/hive-thriftserver/src/main')
-rwxr-xr-x | sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala index bb19ac232f..401e97b162 100755 --- a/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala +++ b/sql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala @@ -292,9 +292,13 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging { } } + var counter = 0 try { while (!out.checkError() && driver.getResults(res)) { - res.foreach(out.println) + res.foreach{ l => + counter += 1 + out.println(l) + } res.clear() } } catch { @@ -311,7 +315,11 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging { ret = cret } - console.printInfo(s"Time taken: $timeTaken seconds", null) + var responseMsg = s"Time taken: $timeTaken seconds" + if (counter != 0) { + responseMsg += s", Fetched $counter row(s)" + } + console.printInfo(responseMsg , null) // Destroy the driver to release all the locks. driver.destroy() } else { |