数据
2018-11-01 07:57:33
1、使用hive内置的时间日期函数完成数据ETL。
select
to_date(time_local) as daystr,
date_format(time_local,'HH:mm:ss'),
month (time_local)as month,
day (time_local)as day,
hour (time_local)as hour
from
ods_weblog_origin
limit
50;
select
to_date(time_local) as daystr,
date_format(time_local,'HH:mm:ss') as tmstr,
date_format(time_local,'MM')as month,
date_format(time_local,'dd')as day,
date_format(time_local,'HH')as hour
from
ods_weblog_origin
limit
50;
2、使用字符串的截取完成数据ETL。
select
substring(time_local,0,10) as daystr,
substring(time_local,12) as tmstr,
substring(time_local,6,2) as month,
substring(time_local,9,2) as day,
substring(time_local,12,2) as hour
from
ods_weblog_origin
limit
50;