// Register DF as temp table ordersDF.registerTempTable("orders") // Run query sqlContext.sql("select * from orders where order_status = 'COMPLETE' limit 10"). foreach(println)