I have a query regarding creating multiple spark sessions in one JVM. I have read that creating multiple contexts is not recommended in earlier versions of Spark. Is it true wit
You can call
getOrCreate
multiple times.
This function may be used to get or instantiate
a SparkContext and register it as a singleton
object. Because we can only have one active SparkContext per JVM, this is useful when applications may wish to share a SparkContext
.
getOrCreate creates a SparkContext
in JVM if there is no SparkContext
available . If SparkContext is already available in JVM it doesn't creates a new but returns the old one
.