Hive中4个By的区别

343 阅读1分钟

1、Order by

全局排序,但是只有一个Reducer

2、Sort by

分区内有序

3、Distribute by

类似MapReudce中的Partition,类似分区,结合Sort by使用

4、Cluster by

当Distribute by和Sort by字段相同时,可以使用Cluster by方式。Cluster by除了具有Distribute by的功能外还兼具Sort by的功能。但是排序只能是升序排序,不能指定排序规则为ASC或者DESC