SparkSQL分区OutOfMemory

我的梦境 提交于 2019-12-27 01:20:54

由于SparkSQL默认200个分区,为了处理小文件决定使用reparation和coalesce重分区,代码如下

(一)df_1.coalesce(1).createOrReplaceTempView(“table_tmp”)
竟然报错。。

Job aborted due to stage failure: Task 1 in stage 8.0 failed 4 times, most recent failure: Lost task 1.3 in stage 8.0 (TID 642, svldl061.csvw.com, executor 8): org.apache.spark.SparkException: Task failed while writing rows.

查看执行过程
在这里插入图片描述
具体原因有待研究??
(二)df_1.repartition(1).createOrReplaceTempView(“table_tmp”)
运行成功了!!!
查看执行过程(和上面几乎一样,不过少了Coalesce这关键一步!!!)
在这里插入图片描述
在这里插入图片描述
区别在于coalesce第八步只有1个分区,repartition第八步有200个分区。

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!