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

相关推荐
weixin_3077791318 小时前
Databricks里用PySpark统计指定表和字段中各字段的空值、空字符串或零值比例
运维·数据仓库·python·spark·云计算
邀星月为媒18 小时前
从零打造一个属于自己的 AI Agent:Core Hive Agent 开源项目解析
人工智能·hive·开源
BI专家之路20 小时前
安装linux/hadoop/jdk/hive
linux·hive·hadoop
2601_962073973 天前
大数据-258 离线数仓 - Griffin架构 配置安装 Livy 架构设计 解压配置 Hadoop Hive
大数据·hadoop·架构
fastjson_3 天前
Hive 基础函数
数据仓库·hive·hadoop
kuroomi3 天前
hadoop高可用架构
hadoop
APItesterCris4 天前
告别人工盯品:借助 OpenClaw 搭建商品自动监控与数据分析系统(完整实操)
大数据·数据库·数据仓库·自动化
千里码aicood4 天前
基于Hadoop的汽车销量分析与可视化
大数据·hadoop·分布式
AbnerWright4 天前
读书笔记-数据密集型应用系统设计
数据仓库
wxchyy5 天前
手把手教你入门云计算(二):这些技术改变了世界,你也能轻松掌握
hadoop·阿里云·docker·云原生·华为云·云计算·运维开发