项目实战从0到1之hive(47)大数据项目之电商数仓(用户行为数据)(十五)
发布日期:2021-05-14 00:18:54 浏览次数:16 分类:博客文章

本文共 7614 字,大约阅读时间需要 25 分钟。

���26��� ������

26.1 ������������������������������

26.1.1 ���������������������������������������

1���ODS������������������������

������������������������������������������������������������������������������������������

2���DWD������������������

���ODS���������������������������������������������������������������������������������

3���DWS������������������������

���DWD������������������������������������������������������������������������������������������

4���ADS������������������������

26.1.2 Tez���������������

Tez������������������������������������������������������������������������������HDFS���������������������������������������������������������������������

26.1.3 ������������������������������UDF���UDTF������������������������������������������������

��������������� ���UDF������������������������������UDTF���������������������������

26.1.4 ���������������������������

������������������������������������id ���������������

26.1.5 ���������������������������

������������������ left join ������������������������������������mid������������������������������

26.1.6 ������������������1������������

������������=��������������� join ������������ ���������������=������������/���������������

26.1.7 ���������������������������

������������id������������������������������������1������������������������������

26.1.8 ���������������������������������

������������left join������������ left join������������������������������id���������������id������null

26.1.9 ���������������������������

������������id���������������������������������������������������

26.1.10 ������������������������3���������������������

������������id������������������������������������������3������

26.1.11 ���������������������������������������������������������

1������������������7��������������������������������������������������������� 2��������������������������������������������������� 3��������������������������������������������������� 4������������������������������������3���������������������������������������������3��������������������������� 21.1.12 ������������������������������������������

26.2 Hive������

26.2.1 Hive���������

26.2.2 Hive������������������

Hive ���������������������������������������������������������������������

1���������������������

Hive ��������� HDFS ���������������������������������������������������������������������

2���������������

Hive������������������������������������������������������������������������������������������������

3���������������

Hive ������������������������������������������������������������������������������������������������������������������������������������������������������������������������������Hive������������������������������������������

4���������������

Hive���������������������������������������������������������������������������������

26.2.3 ���������������������

1���������������������������������������������������Hive��������������������������������������������������������������������������������� 2��������������������������������������������������������������������������������������� 21.2.4 4���By������ 1���Sort By��������������������� 2���Order By������������������������������Reducer��� 3���Distrbute By���������MR���Partition������������������������sort by��������� 4��� Cluster By������Distribute by���Sorts by������������������������������Cluster by���������Cluster by������������Distribute by���������������������Sort by���������������������������������������������������������������������������ASC������DESC���

26.2.5 ������������

1������������������ ���1��� OVER()���������������������������������������������������������������������������������������������������������������������partition by ������order by��������� ���2���CURRENT ROW������������ ���3���n PRECEDING���������n��������� ���4��� n FOLLOWING���������n��������� ���5���UNBOUNDED������������UNBOUNDED PRECEDING ��������������������������� UNBOUNDED FOLLOWING������������������������ ���6��� LAG(col,n)������������n��������� ���7���LEAD(col,n)������������n��������� ���8��� NTILE(n)������������������������������������������������������������������������������������������1���������������������������NTILE���������������������������������������������n���������int��������� 2������������������ ���1���RANK() ������������������������������������������ ���2���DENSE_RANK() ������������������������������������������ ���3���ROW_NUMBER() ���������������������

26.2.6 ������������������������������UDF���UDTF������������������������������������������������

1������������������ 2������UDF������������������������������UDTF��������������������������� 3������������UDF������������������������������UDF���������evaluate������ 4������������UDTF������������������������������GenericUDTF������������������������������������������process���������

26.2.7 Hive������

1���MapJoin ���������������MapJoin���������������MapJoin������������������Hive���������������Join���������������Common Join������������Reduce������������join���������������������������������������MapJoin���������������������������������map���������join���������reducer���������

2��������������� ���������������SELECT������������������������������������������������������������������������SELECT *��� ���������������������������������������������������������������������������������������������Where��������������������������������������������������������� 3���������������������

4��������������������� 5���������������Map��� ���1������������������������������������input���������������������������������map��������� ���������������������������input���������������������input��������������������������������������������������� ���2������������map������������������ ���������������������������������������������������������������������������������128m������������������������������������������������������������map���������������������������map������������������������������������������������������������������������������������������������������������������������������������map������������������ ���3������������������������map������������128m������������������������������������ ���������������������������������������127m������������������������������map������������������������������������������������������������������������������������������������map���������������������������������������map��������������������������������������� ���������������������2���3������������������������������������������������������map������������map������ 6������������������������ ���Map���������������������������������Map������CombineHiveInputFormat���������������������������������������������������������������������HiveInputFormat���������������������������������

7���������������Reduce��� Reduce��������������������������� ���1������������������������������Reduce������������������������������ ���2������������������������Reduce������������������������������������������������������������������������������������������������������������������������������������������������������������������������������ ���������Reduce���������������������������������������������������������������������������������Reduce���������������Reduce���������������������������������������

8��������������� // ���������������������

SET hive.merge.mapfiles = true; -- ������true������map-only������������������������������ SET hive.merge.mapredfiles = true; -- ������false������map-reduce������������������������������ SET hive.merge.size.per.task = 268435456; -- ������256M SET hive.merge.smallfiles.avgsize = 16777216; -- ���������������������������������������������������������������������map-reduce������������������merge

 

上一篇:Spark SQL入门到实战之(8)数据倾斜优化
下一篇:项目实战从0到1之hive(46)大数据项目之电商数仓(用户行为数据)(十四)

发表评论

最新留言

很好
[***.229.124.182]2025年05月03日 10时02分45秒