aboutsummaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorw00228970 <wangfei1@huawei.com>2014-11-24 21:17:24 -0800
committerReynold Xin <rxin@databricks.com>2014-11-24 21:17:32 -0800
commit259cb26fcc6bbd3519cc126d8bb882ac3e58e840 (patch)
tree1d5cb9d0f1864e875a33a898a3a5ba73f0bcf1a8 /sql
parent10e433919a9a3520007099a3876b47f74c046f12 (diff)
downloadspark-259cb26fcc6bbd3519cc126d8bb882ac3e58e840.tar.gz
spark-259cb26fcc6bbd3519cc126d8bb882ac3e58e840.tar.bz2
spark-259cb26fcc6bbd3519cc126d8bb882ac3e58e840.zip
[SQL] Compute timeTaken correctly
```timeTaken``` should not count the time of printing result. Author: w00228970 <wangfei1@huawei.com> Closes #3423 from scwf/time-taken-bug and squashes the following commits: da7e102 [w00228970] compute time taken correctly (cherry picked from commit 723be60e233d0f85944d948efd06845ef546c9f5) Signed-off-by: Reynold Xin <rxin@databricks.com>
Diffstat (limited to 'sql')
-rwxr-xr-xsql/hive-thriftserver/src/main/scala/org/apache/spark/sql/hive/thriftserver/SparkSQLCLIDriver.scala11
1 files changed, 4 insertions, 7 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 2cd02ae926..7385952861 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
@@ -272,8 +272,10 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging {
if (sessionState.getIsVerbose) {
out.println(cmd)
}
-
val rc = driver.run(cmd)
+ val end = System.currentTimeMillis()
+ val timeTaken:Double = (end - start) / 1000.0
+
ret = rc.getResponseCode
if (ret != 0) {
console.printError(rc.getErrorMessage())
@@ -309,12 +311,7 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging {
ret = cret
}
- val end = System.currentTimeMillis()
- if (end > start) {
- val timeTaken:Double = (end - start) / 1000.0
- console.printInfo(s"Time taken: $timeTaken seconds", null)
- }
-
+ console.printInfo(s"Time taken: $timeTaken seconds", null)
// Destroy the driver to release all the locks.
driver.destroy()
} else {