Skip to content
Snippets Groups Projects
Commit 723be60e authored by w00228970's avatar w00228970 Committed by Reynold Xin
Browse files

[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
parent 9ce2bf38
No related branches found
No related tags found
No related merge requests found
...@@ -272,8 +272,10 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging { ...@@ -272,8 +272,10 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging {
if (sessionState.getIsVerbose) { if (sessionState.getIsVerbose) {
out.println(cmd) out.println(cmd)
} }
val rc = driver.run(cmd) val rc = driver.run(cmd)
val end = System.currentTimeMillis()
val timeTaken:Double = (end - start) / 1000.0
ret = rc.getResponseCode ret = rc.getResponseCode
if (ret != 0) { if (ret != 0) {
console.printError(rc.getErrorMessage()) console.printError(rc.getErrorMessage())
...@@ -309,12 +311,7 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging { ...@@ -309,12 +311,7 @@ private[hive] class SparkSQLCLIDriver extends CliDriver with Logging {
ret = cret ret = cret
} }
val end = System.currentTimeMillis() console.printInfo(s"Time taken: $timeTaken seconds", null)
if (end > start) {
val timeTaken:Double = (end - start) / 1000.0
console.printInfo(s"Time taken: $timeTaken seconds", null)
}
// Destroy the driver to release all the locks. // Destroy the driver to release all the locks.
driver.destroy() driver.destroy()
} else { } else {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment