shell脚本生成数据加载到Hive表中
一、hive中建表
- 创建数据库:
create database sales_dw;
use sales_dw;
- 建表:
create table dim_date
(
date_sk int,
date date,
month tinyint,
month_name varchar(16),
quarter tinyint,
year int
) row format delimited fields terminated by ','
stored as textfile;
dim_date 为内部表,字段含义为:
| date_sk | date | month | month_name | quarter | year |
|---|---|---|---|---|---|
| 日期编号 | 日期 | 月份 | 月份名称 | 季度 | 年份 |
二、编写shell 脚本
- 创建脚本文件
vi generate_dim_date.sh
<

最低0.47元/天 解锁文章
2827

被折叠的 条评论
为什么被折叠?



