Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
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
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94k users

Browse Categories

...