Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between Sparkconf and Sparkcontext?

I've encountered a problem with pyspark when I've made Import Pyspark from Sparkcontext but I found that it can be imported from sparkconf as well, I'm asking what's the difference between those two spark class libraries.

like image 429
HISI Avatar asked Dec 05 '25 02:12

HISI


1 Answers

Sparkcontext is the entry point for spark environment. For every sparkapp you need to create the sparkcontext object. In spark 2 you can use sparksession instead of sparkcontext.

Sparkconf is the class which gives you the various option to provide configuration parameters.

Val Conf = new sparkConf().setMaster(“local[*]”).setAppName(“test”)
Val SC  = new sparkContext(Conf)

The spark configuration is passed to spark context. You can also set different application configuration in sparkconf and pass to sparkcontex

like image 147
Chandan Ray Avatar answered Dec 08 '25 13:12

Chandan Ray



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!