sort by
sort by:每个MapReduce内部进行排序,对全局结果集来说并不是排序。
distribute by
distribute by:类似MR中的partition,进行分区,结合sort by使用。
注意:Hive要求distribute by语句要写在sort by语句之前。
cluster by
cluster by:当distribute by和sort by字段相同时,可以使用cluster by方式。
注意:cluster by除了具有distribute by的功能外还兼具sort by的功能,但是排序只能是倒叙排序,不能指定排序规则为asc或者desc。
Hive中sort by、distribute by、cluster by的区别及用法
最新推荐文章于 2022-01-05 10:00:42 发布