Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
f0c09a7c
Commit
f0c09a7c
authored
May 28, 2019
by
王志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试埋点数据
parent
4be69e48
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
102 additions
and
30 deletions
+102
-30
data_feed_exposure_precise.scala
.../src/main/scala/com/gmei/data_feed_exposure_precise.scala
+102
-30
No files found.
eda/feededa/src/main/scala/com/gmei/data_feed_exposure_precise.scala
View file @
f0c09a7c
...
...
@@ -548,6 +548,49 @@ object icon_train_data {
meigou_click
.
show
()
meigou_click
.
createOrReplaceTempView
(
"meigou_click"
)
val
megou_order
=
sc
.
sql
(
s
"""
|SELECT partition_date,device_id,service_id
|from online.ml_meigou_order_detail
|where partition_date='${partition_date}'
|and device_id is not null
"""
.
stripMargin
)
megou_order
.
createOrReplaceTempView
(
"megou_order"
)
val
meigou_jiache
=
sc
.
sql
(
s
"""
|SELECT T.partition_date
| T5_2.device_id AS device_id,
| T5_1.service_id AS service_id
| FROM (SELECT DISTINCT T.partition_date,T.person_id,
| T.service_id AS service_id
| FROM online.tl_meigou_shopcart_view T
| WHERE T.partition_date = '${partition_date}'
| AND from_unixtime(unix_timestamp(to_date(T.added_at), 'yyyy-MM-dd'), 'yyyyMMdd') = '${partition_date}') T5_1 --加入购物车的时间
| LEFT JOIN (SELECT T.person_id AS person_id,
| T5_3.device_id AS device_id
| FROM online.ml_user_updates T
| LATERAL VIEW explode(T.device_list) T5_3 AS device_id
| WHERE T.partition_date = '${partition_date}') T5_2
| ON T5_1.person_id = T5_2.person_id
"""
.
stripMargin
)
meigou_jiache
.
createOrReplaceTempView
(
"meigou_jiache"
)
val
meigou_all
=
sc
.
sql
(
s
"""
|SELECT * from meigou_click
|union all
|select * from megou_order
|union all
|select * from meigou_jiache
"""
.
stripMargin
)
meigou_all
.
createOrReplaceTempView
(
"meigou_all"
)
val
meigou_tags
=
sc
.
sql
(
s
"""
|select * from online.tl_meigou_servicetag_view
...
...
@@ -559,7 +602,7 @@ object icon_train_data {
val
meigou_tag_detail
=
sc
.
sql
(
s
"""
|select a.*,b.tag_id
|from meigou_
click
a
|from meigou_
all
a
|left join meigou_tags b
|on a.service_id=b.service_id
"""
.
stripMargin
...
...
@@ -571,7 +614,7 @@ object icon_train_data {
val
temp_meigou
=
sc
.
sql
(
s
"""
|select '${stat_date}' as stat_date,device_id,tag_id
|from
diary
_tag_detail
|from
meigou
_tag_detail
"""
.
stripMargin
)
...
...
@@ -809,37 +852,38 @@ object test_data {
val
partition_date
=
stat_date
.
replace
(
"-"
,
""
)
//美购加车数据
// val diary_click=sc.sql(
// s"""
// |SELECT T5_1.service_id AS service_id, --美购ID
// | T5_2.device_id AS device_id --设备ID
// | FROM (SELECT DISTINCT T.person_id,
// | T.service_id AS service_id
// | FROM online.tl_meigou_shopcart_view T
// | WHERE T.partition_date = '${partition_date}'
// | AND from_unixtime(unix_timestamp(to_date(T.added_at), 'yyyy-MM-dd'), 'yyyyMMdd') = '${partition_date}') T5_1 --加入购物车的时间
// | LEFT JOIN (SELECT T.person_id AS person_id,
// | T5_3.device_id AS device_id
// | FROM online.ml_user_updates T
// | LATERAL VIEW explode(T.device_list) T5_3 AS device_id
// | WHERE T.partition_date = '${partition_date}') T5_2
// | ON T5_1.person_id = T5_2.person_id
// """.stripMargin
// )
// diary_click.show()
val
meigou_jiache
=
sc
.
sql
(
s
"""
|SELECT T.partition_date
|T5_1.service_id AS service_id,
| T5_2.device_id AS device_id,
| FROM (SELECT DISTINCT T.partition_date,T.person_id,
| T.service_id AS service_id
| FROM online.tl_meigou_shopcart_view T
| WHERE T.partition_date = '${partition_date}'
| AND from_unixtime(unix_timestamp(to_date(T.added_at), 'yyyy-MM-dd'), 'yyyyMMdd') = '${partition_date}') T5_1 --加入购物车的时间
| LEFT JOIN (SELECT T.person_id AS person_id,
| T5_3.device_id AS device_id
| FROM online.ml_user_updates T
| LATERAL VIEW explode(T.device_list) T5_3 AS device_id
| WHERE T.partition_date = '${partition_date}') T5_2
| ON T5_1.person_id = T5_2.person_id
"""
.
stripMargin
)
// meigou_jiache.show()
//美购订单数据
// val megou_click
=sc.sql(
//
s"""
//
|SELECT partition_date,device_id,service_id
//
|from online.ml_meigou_order_detail
//
|where partition_date='${partition_date}'
//
|and device_id is not null
//
""".stripMargin
//
)
// megou_
click
.show()
val
megou_order
=
sc
.
sql
(
s
"""
|SELECT partition_date,device_id,service_id
|from online.ml_meigou_order_detail
|where partition_date='${partition_date}'
|and device_id is not null
"""
.
stripMargin
)
// megou_
order
.show()
//咨询数据
//咨询
美购
数据
val
zixun_click
=
sc
.
sql
(
s
"""
|SELECT cl_id,params['service_id']
...
...
@@ -850,6 +894,34 @@ object test_data {
)
zixun_click
.
show
()
// 百科点击数据
val
wiki_click
=
sc
.
sql
(
s
"""
|SELECT cl_id,params['business_id'] as wiki_id
|from online.tl_hdfs_maidian_view
|where partition_date='20190523'
|and (action='Search_result_wiki_click_item' or action='search_result_click_infomation_item' or action='search_result_wiki_click_recommend_wiki')
"""
.
stripMargin
)
wiki_click
.
show
()
// 补单美购数据
val
budan_click
=
sc
.
sql
(
s
"""
|SELECT cl_id,params['business_id'] as wiki_id
|from online.tl_hdfs_maidian_view
|where partition_date='20190523'
|and (action='Search_result_wiki_click_item' or action='search_result_click_infomation_item' or action='search_result_wiki_click_recommend_wiki')
"""
.
stripMargin
)
wiki_click
.
show
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment