1、hive 格式化时间戳
1.1 时间戳10位 单位为(秒)
time = 1583927782
select from_unixtime(time,'yyyy-MM-dd HH:mm:ss') date from log limit 10;
1.2 时间戳为13位 单位为(毫秒)
time = 1583927782469;
select from_unixtime(cast(time/1000 as bigint), 'yyyy-MM-dd HH:mm:ss') date from log limit 10;
1.3 查看分区表所有分区
show partitions p_statdate_test;
1.4 删除带有数据的数据库 database
drop database db_test cascade ;
drop database if exists db_test;
2、替换特殊字符
(过程,先转成十六进制,再把正确的内容转成十六进制,对比找出特殊字符,再转成dec)
select unhex(replace(hex(keyword),'0D','')) from db_source.text where id='zdfdfa15616'
3、修改表名 table name
alter table r_enterprisewechat_d rename to r_enterprise_wechat_d;