set mapreduce.job.reduce=3;insert overwrite local directory '/home/data/distribute-result'select*from distribute by deptno sort by empno desc;
distribute by 一般和sort by一起使用
Cluster by
当distribute by和sort by字段相同时,可以使用cluster by
同时cluster by还具有排序的功能,但是只可以是升序排序的
演示:
set mapreduce.job.reduce=3;insert overwrite local directory '/home/data/distribute-result'select*from distribute by deptno sort by empno deptno;//上面的可以写成set mapreduce.job.reduce=3;insert overwrite local directory '/home/data/distribute-result'select*from cluster by deptno;