Spark 1.4 increase maxResultSize memory

后端 未结 7 2165
花落未央
花落未央 2020-12-13 00:06

I am using Spark 1.4 for my research and struggling with the memory settings. My machine has 16GB of memory so no problem there since the size of my file is only 300MB. Alth

7条回答
  •  遥遥无期
    2020-12-13 00:30

    You can set spark.driver.maxResultSize parameter in the SparkConf object:

    from pyspark import SparkConf, SparkContext
    
    # In Jupyter you have to stop the current context first
    sc.stop()
    
    # Create new config
    conf = (SparkConf()
        .set("spark.driver.maxResultSize", "2g"))
    
    # Create new context
    sc = SparkContext(conf=conf)
    

    You should probably create a new SQLContext as well:

    from pyspark.sql import SQLContext
    sqlContext = SQLContext(sc)
    

提交回复
热议问题