Calculate the running time for spark sql -


i'm trying run couple of spark sql statements , want calculate running time.

one of solution resort log. i’m wondering there other simpler methods it. following:

import time  starttimequery = time.clock() df = sqlcontext.sql(query) df.show() endtimequery = time.clock() runtimequery = endtimequery - starttimequery 

if you're using spark-shell (scala) try defining timing function this:

def show_timing[t](proc: => t): t = {     val start=system.nanotime()     val res = proc // call code     val end = system.nanotime()     println("time elapsed: " + (end-start)/1000 + " microsecs")     res } 

then can try:

val df = show_timing{sqlcontext.sql(query)} 

Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -