• hive搜索语句总结


    1.排序order by(在使用order by的时候必须要指定通过那一列进行排序,其中asc升序(默认),desc为降序):

    select * from emp order by sal;
     
    2.sort by对每个分区内部进行排序:
    首先可以通过  set mapreduce.job.reduces=3; 设置分区数,这里是将分区数设置为3,然后可以通过set mapreduce.job.reduces;来查看当前分区的个数。
    select * from emp sort by deptno desc;
    上面语句的执行结果就是对每个分区的数据进行排序,整体数据局部有序;
     
    3.distribute by 进行将指定行分配到指定分区,其中distribute by 的分区规则是根据分区字段的 hash 码与 reduce 的个数进行模除后,余数相同的分到一个区。
    select * from emp distribute by deptno sort by empno desc;
     
    4.Cluster By,当 distribute by 和 sorts by 字段相同时,可以使用 cluster by 方式,但是排序只能是升序,不能指定排序规则为 ASC 或者 DESC。
    select * from emp cluster by deptno;
     
    5.修改hive表中某一列的列名:
    alter table dept change column deptdesc desc string;
     
    6.修改表名:
    alter table dept_partition2 rename to dept_partition3;
  • 相关阅读:
    新的学期,新的学习
    织梦最新
    selectd选项跳转链接
    字体统一大小
    js点击后进入到另一个页面的TAB选项中
    织梦套后台
    js获取距离各边的距离
    将时间的秒数转化为分钟数
    jquery手写tab选项卡功能
    js中的定时器
  • 原文地址:https://www.cnblogs.com/wfswf/p/15391415.html
Copyright © 2020-2023  润新知