0


2024年全国职业院校技能大赛中职组大数据应用与服务赛项题库参考答案陆续更新中,敬请期待…_唯众智创 大数据 赛题(1)

(2)启动Hive的动态分区功能,并将Hive设置为非严格模式;
答:

set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nostrict;

(3)使用insert overwrite … select …子句将dwd_behavior_log表中数据插入分区表dws_behavior_log中,并实现根据dt进行动态分区;
答:

insert overwrite table dws_behavior_log PARTITION (dt) select * from dwd_behavior_log;

(4)查看dws_behavior_log表的所有现有分区、前3行数据,并统计统计表数据总行数;
答:

SHOW PARTITIONS dws_behavior_log;
SELECT * FROM dwd_behavior_log LIMIT 3;
SELECT count(*) FROM dws_behavior_log;

(5)在comm数据库下创建一个名为dim_date的外部表,如果表已存在,则先删除;另外,要求指定表的存储路径为HDFS的/behavior/dim/dim_date目录,字段分隔符为 “\t” , 建 表 时 添 加 TBLPROPERTIES
(‘skip.header.line.count’=‘1’) 语句让Hive读取外表数据时跳过文件行首(表头);字段类型如下表所示;
表7 字段类型表
在这里插入图片描述
答:

DROP TABLE IF EXISTS comm.dim_date;
create external table comm.dim_date(date_id string,week_id string,week_day string,day string,month string,quarter string,year string,is_workday string,holiday string) row format delimited fields terminated by '\t' location '/behavior/dim/dim\_date' TBLPROPERTIES ('skip.header.line.count'='1');

(6)在comm数据库下创建一个名为dim_area的外部表,如果表已存在,则先删除

标签: 大数据

本文转载自: https://blog.csdn.net/2401_84141401/article/details/137701257
版权归原作者 2401_84141401 所有, 如有侵权,请联系我们删除。

“2024年全国职业院校技能大赛中职组大数据应用与服务赛项题库参考答案陆续更新中,敬请期待…_唯众智创 大数据 赛题(1)”的评论:

还没有评论