If you use a scala, you can try to define a synchronization function as follows:
def show_timing[T](proc: => T): T = { val start=System.nanoTime() val res = proc // call the code val end = System.nanoTime() println("Time elapsed: " + (end-start)/1000 + " microsecs") res }
Then you can try:
val df = show_timing{sqlContext.sql(query)}
source share