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

相关推荐
罗政2 小时前
基于AI工作流的多渠道销售数据仓库清洗统计实践
数据仓库
极光代码工作室8 小时前
基于Spark的日志监控与分析平台
大数据·hadoop·python·spark·数据可视化
迈巴赫车主1 天前
湖仓一体(Data Lakehouse)简介
大数据·数据仓库·数据湖·湖仓一体
liuxiaowei32 天前
Winform+WPF双框架实战:喷涂工艺SCADA上位机从0到1搭建(附采集监控源码+车间踩坑实录)
大数据·hadoop·wpf
humbinal2 天前
同时支持 gui & cli 的 parquet 文件查看工具,高性能小清新!
hive·python·rust·spark·开源·github·parquet
RestCloud4 天前
ETL是什么?全域数据集成平台核心能力解析
数据仓库·etl·数据清洗·数据处理·etlcloud·数据集成工具
Gent_倪4 天前
万字详解:数据库、数据仓库、数据湖、湖仓一体
数据库·数据仓库·spark
Microsoft Word4 天前
把RAG从 “能跑” 做到上线
数据仓库·人工智能
hkNaruto4 天前
【大数据】《传统Hadoop大数据技术入门:补充与进阶——从数据格式到智能决策的问答实录》
大数据·hadoop·分布式
吾AI科技4 天前
基于Tez引擎的 Hive SQL 性能优化
大数据·hive·性能优化·tez