Get the App
SLTechnology News&Howtos  ›  Database  › 

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

Shulou Source: shulou.com Published: 2022-05-31 12:23:06 11月14日 Update

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

Tags: Users content configuration time scope files learning products commands cities information that is ideas situations articles more knowledge knowledge points articles results Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info macOS NVidia Xiaomi Redmi