Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Big Data Hadoop & Spark by (45.3k points)
Is there any code for the Spark Integration?

1 Answer

0 votes
by (16.8k points)

Try this: 

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()

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...