修炼离线:(五)hbase映射表插入hive

一:创建hive表。

sql
--drop table if exists ods.odsyyy;
create table if not exists ods.odsfff(
     row_id                    string        comment    '行记录唯一ID,对应ROW_KEY'
    ,aaa string        comment    'aaa'
    ,bbb string        comment    'bbb'
    ,ccc string        comment    'ccc'
    ,ddd string        comment    'ddd'
    ,create_time		comment    '创建时间'
    ,edit_time			comment    '更新时间'
)comment 'ods层数xxxx'
partitioned by (p_dt string comment '分区日期(yyyy-MM-dd)')
row format delimited
    fields terminated by '\t'
    collection items terminated by '\n'
stored as orc;`

二:将数据插入表。

insert overwrite table ods.odsyyy partition(p_dt='${dealDate}')
select
    a.row_id
     ,a.aaa
     ,a.bbb
     ,a.ccc
     ,a.ddd
     ,a.create_time
     ,a.edit_time
from ods.ods_yyy_hb as a
WHERE (coalesce(to_date(a.create_time),'${dealDate}') <= '${dealDate}'
    or coalesce(to_date(a.edit_time),'${dealDate}') <= '${dealDate}')

文章来源地址https://uudwc.com/A/gV3DG

原文地址:https://blog.csdn.net/weixin_43446246/article/details/133078724

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请联系站长进行投诉反馈,一经查实,立即删除!

上一篇 2023年09月24日 12:10
《动手学深度学习 Pytorch版》 7.4 含并行连接的网络(GoogLeNet)
下一篇 2023年09月24日 12:10