(1)order by:全局排序,只有一个Reducer
(2)sort by:分区内有序
(3)distribute by:类似MR中Partition进行分区,结合sort by使用
(4)cluster by:当distribute by和sort by字段相同时,可以使用cluster by方式。cluster by除了具有distribute by的功能外还兼具sort by的功能。但是排序只能是升序排序,不能指定排序规则为ASC或者DESC。
在生产环境中order by用的比较少,容易导致OOM。
在生产环境中sort by+distribute by用的多。
04-4个By区别
最新推荐文章于 2022-08-14 16:37:18 发布