Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to configure a certain time range for users by Sqoop+Hive+MySQL

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to configure a certain time range for users in Sqoop+Hive+MySQL". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to configure a certain time range for users in Sqoop+Hive+MySQL".

I. create a configuration file

[1. Create a table_env file and add the following]

Execute command: vi table_env

Content:

Here) collapse or open

Insert overwrite directory'{hivevar:hdfs_path} 'ROW FORMAT DELIMITED FIELDS TERMINATED BY' ${hivevar:field_term} 'select * from (select c.

Sum (rn) visit_num

Row_number () over (partition by c.area order by sum (rn) desc) rn

'${hivevar:action_time}' action_time

From city_info c join (

Select product_id,city_id,count (1) rn from user_click where action_time='$ {hivevar:action_time} 'group by product_id,city_id

) u join product_info p

On c.city_id = case when u.city_id is null then concat ('cityid',rand ()) else u.city_id end

And p.product_id = case when u.product_id is null then concat ('prodid',rand ()) else u.product_id end

Group by c.area.productpapername) a

Where a.rn

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report