栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

hive的操作语句

hive的操作语句

create table if not exists part1(
	uid int,
	uname string,
	uage int
)
PARTITIonED BY (country string)
	row format delimited 
	fields terminated by ','
;

alter table part1 add if not exists partition(country='china');
alter table part1 add if not exists partition(country='japan');

show partitions part1

create table if not exists part2(
uid int,
uname string,
uage int
)
PARTITIonED BY (year string,month string)
row format delimited 
fields terminated by ','
;

alter table part2 add if not exists partition(year=2015,month=12);

show partitions part2



alter table part1 add partition(country='Vietnam')
	location '/user/hive/warehouse/xxx'
;

alter table part1 drop partition(country='Vietnam');


alter table part1 partition(country='Vietnam') set location ‘hdfs://hadoop01:9000/user/hive/warehouse/brz.db/part1/country=Vietnam’




load data local inpath '/usr/local/xxx' into table part1
partition(year,month); 


create table if not exists part_tmp(
uid int,
uname string,
uage int,
year string,
month string
)
row format delimited 
fields terminated by ','
;




create table if not exists dy_part2(
uid int,
uname string,
uage int
)
PARTITIonED BY (year string,month string)
row format delimited 
fields terminated by ','
;

insert into dy_part2 partition(year='2018',month)
select uid,uname,uage,month from part_tmp
;

show partitions dy_part2


insert into dy_part2 partition(year='2018',month) values('1','2','3','7')
insert into dy_part2 partition(year='2017',month='1') values('1','2','3')



desc formatted hive_clickhouse
desc formatted partX
desc formatted dy_part2
desc formatted part2
desc formatted ffge_test
desc formatted test_fx

SHOW CREATE TABLE hive_clickhouse
create table if not exists dt_part1(
uid int,
uname string,
uage int
)
PARTITIonED BY (year string,month string)
row format delimited 
fields terminated by ','
;


load data local inpath '/usr/local/xxx' into table part1
partition(year,month); 


create table if not exists part_tmp(
uid int,
uname string,
uage int,
year string,
month string
)
row format delimited 
fields terminated by ','
;

insert into dt_part1 partition(year,month)
select * from part_tmp;
select PART_NAME FROM PARTITIONS WHERe TBL_ID=(SELECt TBL_ID FROM TBLS WHERe TBL_NAME='dy_part2');


insert into acct_wt_user_avg_stock_hold_days partition 
(part_init_date='20190425',interval_type=1) ;


select '20190425','4567890',30 from acct_wt_user_hold_stock_earnging_ratio limit 1;


alter table person_partition add if not exists partition(year=2015,month=12,day=26);
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/761202.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号