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;

  • 相关阅读:
    杀毒软件工作原理
    IP地址
    网络操作系统功能和基本任务
    计算机网络技术知识点总结
    对称密钥密码体制的主要特点
    无线局域网(WLAN)
    文件传输协议(FTP)
    万维网(WWW)
    简单网络管理协议(SNMP)
    防火墙技术
  • 原文地址:https://www.cnblogs.com/lccyb/p/9488110.html
Copyright © 2011-2022 走看看