zoukankan      html  css  js  c++  java
  • hive常用命令

    1.创建hive表:
    create table tabname(
    id int,
    name string
    )partitioned by (year int,month int,day int)
    row format delimited fields terminated by' '
    lines terminated by' '
    stored as textfile;
    2.添加数据:
    (1)从本地添加:
    load data local inpath '/home/data/a.txt' into table a;
    (2)从hdfs添加:
    load data inpath 'x/x/x.log' overwrite into table a;
    (3)从hive表结果数据添加:
    insert into table a select * from b;
    3.查看表中的分区:
    show partitions tabname;
    4.修改表名:
    alter table a rename to b;
    5.修改列名和类型:
    alter table a change cloumn a b int after class;
    6.增加列:
    alter table a add cloumns(a int,b string);
    7.替换列:
    alter table a replace cloumns(a int,b string);
    8.修改表属性:
    alter table a set tblproperties('EXTERNAL'='true');外转内>关键字必须大写
    9.赋权:
    grant all on uri 'hdfs://nameservice//user/xxx/test/' to role USERGROUP;
    grant 'user','RW','tablename'
    10.批量执行hive脚本
    $bin/hive -f test
    hive> source /home/wyp/Documents/test;

  • 相关阅读:
    SpringAOP-基于@AspectJ的简单入门
    SpringAOP-切面优先级
    Commons_IO_FileUtils的使用
    java_IO_装饰器
    java_IO_3
    java_IO_2
    java_IO_1
    App Inventor
    java学习_5_24
    java学习_5_23
  • 原文地址:https://www.cnblogs.com/lccyb/p/9488110.html
Copyright © 2011-2022 走看看