Hive常用命令汇总
Hive删除某一个分区数据
| alter table ods_student drop partition(dt='2019-07-06') alter table ods_iot_linkage drop partition(dt='2020-07-06',hour='09')
|
Hive中显示表所有分区
| show partitions ods_student
|
Hive 显示表信息
| show ctreate table ods_student desc ods_student
|
Hive日期函数
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| SELECT current_timestamp();
SELECT current_date; OR SELECT current_date();
SELECT UNIX_TIMESTAMP();
select substr(current_timestamp, 0, 10);
select date_sub(current_date, 1);
select to_date("2017-10-22 10:10:10");
select datediff("2017-10-22", "2017-10-12");
select datediff("2017-10-22 10:10:10", "2017-10-12 23:10:10");
select datediff("2017-10-22 01:10:10", "2017-10-12 23:10:10");
select from_unixtime(cast(substr("1504684212155", 0,10) as int)) dt;
select to_date(from_unixtime(UNIX_TIMESTAMP()));
select FROM_UNIXTIME(UNIX_TIMESTAMP(),'yyyy-MM-dd 10:30:00');
select concat(date_sub(current_date,1),' 20:30:00');
select date_format(date_sub(current_date,1),'yyyy-MM-dd 20:30:00');
|