hive常用命令
来源:互联网 发布:涂鸦照片的软件 编辑:程序博客网 时间:2024/05/01 23:30
hive常用命令
#创建新表
hive> CREATE TABLE t_hive (a int, b int, c int) ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t';
#导入数据t_hive.txt到t_hive表
hive> LOAD DATA LOCAL INPATH '/home/cos/demo/t_hive.txt' OVERWRITE INTO TABLE t_hive ;
#正则匹配表名
hive>show tables '*t*';
#增加一个字段
hive> ALTER TABLE t_hive ADD COLUMNS (new_col String);
#重命令表名
hive> ALTER TABLE t_hive RENAME TO t_hadoop;
#从HDFS加载数据
hive> LOAD DATA INPATH '/user/hive/warehouse/t_hive/t_hive.txt' OVERWRITE INTO TABLE t_hive2;
#从其他表导入数据
hive> INSERT OVERWRITE TABLE t_hive2 SELECT * FROM t_hive ;
#创建表并从其他表导入数据
hive> CREATE TABLE t_hive AS SELECT * FROM t_hive2 ;
#仅复制表结构不导数据
hive> CREATE TABLE t_hive3 LIKE t_hive;
#通过Hive导出到本地文件系统
hive> INSERT OVERWRITE LOCAL DIRECTORY '/tmp/t_hive' SELECT * FROM t_hive;
#Hive查询HiveQL
from ( select b,c as c2 from t_hive) t select t.b, t.c2 limit 2;
select b,c from t_hive limit 2;
#创建视图
hive> CREATE VIEW v_hive AS SELECT a,b FROM t_hive;
#删表
drop table if exists t_hft;
#创建分区表
DROP TABLE IF EXISTS t_hft;
CREATE TABLE t_hft(
SecurityID STRING,
tradeTime STRING,
PreClosePx DOUBLE
) PARTITIONED BY (tradeDate INT)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',';
#导入分区数据
hive> load data local inpath '/home/BlueBreeze/data/t_hft_1.csv' overwrite into table t_hft partition(tradeDate=20130627);
#查看分区表
hive> SHOW PARTITIONS t_hft;
- hive 常用命令
- hive 常用命令
- hive常用命令
- Hive 常用命令
- Hive常用命令
- hive常用命令
- hive 常用命令
- Hive常用命令
- Hive - 常用命令
- hive 常用命令
- hive常用命令
- Hive常用命令
- hive常用命令
- hive常用命令
- Hive常用命令
- hive常用命令
- hive常用命令
- hive常用命令
- 行测 加强题型 加强论证
- redis源码分析 -- 链表结构
- git分支管理策略
- 兼容的firstChild,lastChild,nextSibling,previousSibling
- 简单枚举类型——植物与颜色
- hive常用命令
- HDU ACM 14 1398 Square Coins
- Lightoj1037【状压DP】
- Android 工具类,持续更新
- ORACLE全部ORA错误收集整理
- 检索二维数组
- 67. 可伸缩的 Comet
- HIVE Metastore中Local/Embedded Metastore Server的配置分析
- linux_sqlite3添加新信息,插入信息