Skip to content

Commit

Permalink
[SQL] Compute timeTaken correctly
Browse files Browse the repository at this point in the history
```timeTaken``` should not count the time of printing result.

Author: w00228970 <[email protected]>

Closes #3423 from scwf/time-taken-bug and squashes the following commits:

da7e102 [w00228970] compute time taken correctly
  • Loading branch information
scwf authored and rxin committed Nov 25, 2014
1 parent 9ce2bf3 commit 723be60
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 723be60

Please sign in to comment.