Hive中sort by、distribute by、cluster by的区别及用法

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。


版权声明:本文为qq_42826453原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。