我无法调整执行器和驱动程序的内存。
from pyspark import SparkContext, SparkConf
from pyspark.sql import HiveContext
conf = pyspark.SparkConf().setAll([('spark.executor.memory', '2g'),('spark.driver.memory','2g')])
sc.stop()
sc = pyspark.SparkContext(conf=conf)
sc._conf.getAll()
hc = HiveContext(sc)
sc._conf.getAll()在hc = HiveContext(sc)之前运行sc._conf.getAll()时,我可以看到我的内存已经根据需要进行了调整。但是,当在hc = HiveContext(sc)之后运行sc._conf.getAll()时,内存将恢复为默认值。
发布于 2019-01-03 22:07:17
如果可能,请使用SparkSession (从Spark2.0开始提供)而不是SparkContext,这样您就可以在.conf中添加配置
from pyspark.sql import SparkSession
warehouseLocation = "/hive/user/location"
spark2 = SparkSession\
.builder.appName("SparkAppName")\
.config("spark.sql.warehouse.dir", warehouseLocation)\
.config("spark.executor.memory", "2g")\
.config("spark.executor.executor", "3g")\
.enableHiveSupport()\
.getOrCreate()https://stackoverflow.com/questions/54013242
复制相似问题