Multiple SparkSessions in single JVM

后端 未结 4 1801
没有蜡笔的小新
没有蜡笔的小新 2021-02-05 10:15

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

4条回答
  •  北恋
    北恋 (楼主)
    2021-02-05 10:46

    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.

提交回复
热议问题