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';

相关推荐
tsyjjOvO1 天前
SpringMVC 从入门到精通
数据仓库·hive·hadoop
Francek Chen1 天前
【大数据存储与管理】分布式数据库HBase:05 HBase运行机制
大数据·数据库·hadoop·分布式·hdfs·hbase
zzzzzwbetter1 天前
Hadoop完全分布式部署-Master的NameNode以及Slaver2的DataNode未启动
大数据·hadoop·分布式
weixin_449310841 天前
ETL转换和数据写入小满OKKICRM的技术细节
数据仓库·php·etl
IvanCodes1 天前
Hive IDE连接及UDF实战
ide·hive·hadoop
yumgpkpm1 天前
华为昇腾910B 开源软件GPUStack的介绍(Cloudera CDH、CDP)
人工智能·hadoop·elasticsearch·flink·kafka·企业微信·big data
lifewange2 天前
Hive数据库
数据库·hive·hadoop
五月天的尾巴3 天前
hive数据库模糊查询表名
hive·查询表名
蓝魔Y3 天前
hive—1.1、执行优化
hive
快乐非自愿3 天前
OpenClaw 生态适配:Hadoop/Hive 技能现状与企业级集成方案
大数据·hive·hadoop·分布式·openclaw