标签:keyword director class mat one button bee date lse
-- 内部表
create table aa(col1 string,col2 int) partitioned by(statdate int) ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘\t‘;
-- 外部表
create external table bb(col1 string, col2 int) partitioned by(statdate int) ROW FORMAT DELIMITED FIELDS TERMINATED BY ‘\t‘ location ‘/user/gaofei.lu/‘;
show create table tablename;
本地数据:load data local inpath ‘ /home/gaofei.lu/aa.txt‘ into table aa partition(statdate=20170403)
hdfs上数据:load data inpath ‘/user/gaofei.lu/aa.txt‘ into table bb partition(statdate=20170403)
alter table aa set tblproperties (‘EXTERNAL‘=‘TRUE‘)
alter table bb set tblproperties (‘EXTERNAL‘=‘FALSE‘)
修改列名和列数据类型:alter table aa change col2 name string ;
修改位置放置第一位:alter table aa change col2 name string first;
修改位置指定某一列后面:alter table aa change col1 dept string after name;
alter table aa add columns(col3 string);
alter table aa rename to aa_test;
alter table aa add partition(statdate=20170404);
alter table bb add partition(statdate=20170404) location ‘/user/gaofei.lu/20170404.txt‘;
show partitioins aa;
alter table aa partition(statdate=20170404) rename to partition(statdate=20170405);
alter table bb partition(statdate=20170404) set location ‘/user/gaofei.lu/aa.txt‘;
alter table aa drop if exists partition(statdate=20170404);
beeline !connect jdbc:hive2://192.168.1.17:10000
set hive.execution.engine=spark
yarn application -kill job_id
insert overwrite local directory ‘/home/hadoop/gaofeilu/test_delimited.txt‘
row format delimited
fields terminated by ‘\t‘
select * from test;
标签:keyword director class mat one button bee date lse
原文地址:https://www.cnblogs.com/sx66/p/12039542.html