[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
This commit is contained in:
OopsOutOfMemory 2015-02-16 12:34:09 -08:00 committed by Michael Armbrust
parent 104b2c4580
commit b4d7c7032d

View file

@ -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 {