Back
Try this:
spark-shellimport org.apache.spark.sql.hive.HiveContextval sqlContext = new HiveContext(sc)val customers = sqlContext.sql("select * from retail.customer")customers.collect.foreach(println);customers.registerTempTable("customer");val topprof = spark.sql("select profession, count(*) as headcount fromcustomer group by profession order by headcount desc LIMIT 5")topprof.show()
spark-shell
import org.apache.spark.sql.hive.HiveContext
val sqlContext = new HiveContext(sc)
val customers = sqlContext.sql("select * from retail.customer")
customers.collect.foreach(println);
customers.registerTempTable("customer");
val topprof = spark.sql("select profession, count(*) as headcount from
customer group by profession order by headcount desc LIMIT 5")
topprof.show()
31k questions
32.8k answers
501 comments
693 users