HIVE中,cluster by有什么意义

1. cluster by 是什么?

      如果想彻底了解:HIVE中,order by、sort by、 distribute by和 cluster by的区别,请查看HIVE中,order by、sort by、 distribute by和 cluster by的区别。网址:https://blog.csdn.net/weixin_42845682/article/details/104953351

2. cluster by有什么意义?

      你应该已经知道了:当distribute by 和 sort by 所指定的字段相同时,即可以使用cluster by。但是,有人禁不住就要问:那cluster by有什么存在意义吗?按照XX字段分区又按照XX字段排序。
      答案是:当分区数量小于字段种类时,就有意义。
       举个例子:
       有一张学生表,全校共有100个专业,但是因为性能问题,分区只能指定5个。这时候,按照专业分区,再按照专业排序就有存在的意义了。
      

发布了48 篇原创文章 · 获赞 36 · 访问量 13万+

猜你喜欢

转载自blog.csdn.net/weixin_42845682/article/details/104954071