hive案例

ods

create table house_ods_table(

region string,

subway_station string,

type string,

area int,

floor_level string,

total_price int,

unit_price int,

distance string)

row format delimited fields terminated by '\t'

location '/hive';

load data local inpath '/opt/datas/house.txt'

overwrite into table house_ods_table;

dwd

create table house_dwd_table (

subway_station string,

type string,

area double,

floor_level string,

total_floor int,

total_price int,

unit_price int,

distance string

)

partitioned by (region string)

row format delimited

fields terminated by '\t';

set hive.exec.dynamic.partition=true;

set hive.exec.dynamic.partition.mode=nonstrict;

INSERT INTO table house_dwd_table PARTITION(region)

SELECT

subway_station,

type,

area,

substring_index(floor_level,'(',1) as floor_level, substring_index(substring_index(floor_level,'共',-1),'层',1) as total_floor,

total_price,

unit_price,

distance,

region

FROM house_ods_database.house_ods_table;

dws

create table priceavg_dws_table(

priceavg double,

type string,

area double,

floor_leval string,

distance string,

group_type string)

row format delimited fields terminated by'\t';

insert into table priceavg_dws_table

select avg(unit_price) priceavg,type,-1 as area,'-1' as floor_level,'-1' as distance,'1' as group_type

from house_dwd_database.house_dwd_table

where region='CPQ'

group by type;

dws

create table salenum_dws_table(

salenum double,

type string,

area double,

floor_leval string,

distance string,

group_type string)

row format delimited fields terminated by'\t';

相关推荐
注塑机数据采集联网14 小时前
注塑机数据采集网关读取注塑机工艺/SPC数据计算原理
大数据·网络·数据仓库·物联网·智能路由器·制造
ha_lydms2 天前
Datetime Functions(日期时间函数)
大数据·hadoop·阿里云·spark·数据处理·dataworks·maxcompute
ha_lydms2 天前
Bitwise Functions(位运算函数)
大数据·hadoop·阿里云·spark·数据处理·dataworks·maxcompute
ha_lydms2 天前
St Functions(空间函数)
大数据·hadoop·阿里云·spark·数据处理·dataworks·maxcompute
成都蜀味缘餐饮技术培训学校2 天前
油炸串串技术培训实战指南,核心食材选购与预处理标准
数据仓库·经验分享·笔记·课程设计·微信公众平台
ha_lydms2 天前
Table Functions(表函数)
大数据·hadoop·阿里云·spark·数据处理·dataworks·maxcompute
ha_lydms3 天前
Json Functions(JSON 函数)
大数据·hadoop·spark·json·数据处理·dataworks·maxcompute
171320330计算机毕设编程3 天前
计算机毕业设计 基于Hadoop的新能源汽车发展前景分析 LW PPT
java·大数据·hadoop·python·算法·随机森林·线性回归
ha_lydms3 天前
Conditional Functions(条件函数)
大数据·hadoop·阿里云·spark·数据处理·dataworks·maxcompute
程序员大阳3 天前
副队长大数据教程(7)--Hadoop 集群角色配置逻辑详解
大数据·hadoop·分布式·集群·配置·角色·逻辑