题目:2、数据清洗:
要求将day_id一列中的数值清洗为真实的日期格式,可用字符串表示。
数据1对应日期2023-09-01,依次类推,15对应日期2023-09-15
二、数据清洗
(2)创建表格存放清洗后的数据:
create table sales_y(day_id string,sale_nbr string,buy_nbr string,cnt string,round string)
row format delimited fields terminated by ',';
2、插入清洗后的数据,并查询结果
insert overwrite table sales_y select date_add('2021-09-00',cast(day_id as int)) as day_id,sale_nbr as sale_nbr,buy_nbr as buy_nbr,cnt as cnt,round as round from sales;
select * from sales_y;
标签:数据分析,string,nbr,sales,HIVE,day,清洗,id
From: https://www.cnblogs.com/yzx-sir/p/17724729.html