1、 order by 排序,全局排序,默认升序, 只有一个reducer, 导致运行缓慢, 需要较长的计算时间。
2、 sort by 局部排序,其在数据进入reducer前完成排序,因此如果用sort by 进行排序,并且设置 maped.reduce.task?> 1 则,sort by 只能保证每个 reducer输出有序,不能保证全局有序。
3、 distribute by 根据指定的字段将数据分到不同的reduer ,且分发算法是hash散列,类似 分桶的盖脸,按照指定的distributeby 字段和设置的 reducertask的个数进行取余分组, 但是并没有排序,只是分区,并没有排序。
4、cluster by 除了具有distribute by的功能外,还会对该字段进行排序。 cluster by = distribue by + sort by .