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

相关推荐
AC赳赳老秦2 小时前
代码生成超越 GPT-4:DeepSeek-V4 编程任务实战与 2026 开发者效率提升指南
数据库·数据仓库·人工智能·科技·rabbitmq·memcache·deepseek
心疼你的一切2 小时前
拆解 CANN 仓库:实现 AIGC 文本生成昇腾端部署
数据仓库·深度学习·aigc·cann
心疼你的一切3 小时前
模态交响:CANN驱动的跨模态AIGC统一架构
数据仓库·深度学习·架构·aigc·cann
心疼你的一切3 小时前
解锁CANN仓库核心能力:从零搭建AIGC轻量文本生成实战(附代码+流程图)
数据仓库·深度学习·aigc·流程图·cann
秃了也弱了。5 小时前
StarRocks:高性能分析型数据仓库
数据仓库
心疼你的一切6 小时前
数字智人:CANN加速的实时数字人生成与交互
数据仓库·深度学习·aigc·交互·cann
心疼你的一切6 小时前
语音革命:CANN驱动实时语音合成的技术突破
数据仓库·开源·aigc·cann
心疼你的一切6 小时前
解构CANN仓库:AIGC API从底层逻辑到实战落地,解锁国产化AI生成算力
数据仓库·人工智能·深度学习·aigc·cann
心疼你的一切7 小时前
基于CANN仓库算力手把手实现Stable Diffusion图像生成(附完整代码+流程图)
数据仓库·深度学习·stable diffusion·aigc·流程图·cann
心疼你的一切7 小时前
代码革命:CANN加速的AI编程助手实战
数据仓库·深度学习·aigc·ai编程·cann