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
450138d2
Commit
450138d2
authored
May 28, 2019
by
王志伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
测试埋点数据
parent
04b52880
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
0 deletions
+83
-0
data_feed_exposure_precise.scala
.../src/main/scala/com/gmei/data_feed_exposure_precise.scala
+83
-0
No files found.
eda/feededa/src/main/scala/com/gmei/data_feed_exposure_precise.scala
View file @
450138d2
...
...
@@ -754,6 +754,89 @@ object tag_value {
println
(
"写入完成"
)
}
}
}
object
test_data
{
Logger
.
getLogger
(
"org.apache.spark"
).
setLevel
(
Level
.
WARN
)
Logger
.
getLogger
(
"org.apache.eclipse.jetty.server"
).
setLevel
(
Level
.
OFF
)
case
class
Params
(
env
:
String
=
"dev"
,
date
:
String
=
"2018-08-01"
)
extends
AbstractParams
[
Params
]
with
Serializable
val
defaultParams
=
Params
()
val
parser
=
new
OptionParser
[
Params
](
"Feed_EDA"
)
{
head
(
"WeafareStat"
)
opt
[
String
](
"env"
)
.
text
(
s
"the databases environment you used"
)
.
action
((
x
,
c
)
=>
c
.
copy
(
env
=
x
))
opt
[
String
]
(
"date"
)
.
text
(
s
"the date you used"
)
.
action
((
x
,
c
)
=>
c
.
copy
(
date
=
x
))
note
(
"""
|For example, the following command runs this app on a tidb dataset:
|
| spark-submit --class com.gmei.WeafareStat ./target/scala-2.11/feededa-assembly-0.1.jar \
"""
.
stripMargin
+
s
"| --env ${defaultParams.env}"
)
}
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
parser
.
parse
(
args
,
defaultParams
).
map
{
param
=>
GmeiConfig
.
setup
(
param
.
env
)
val
spark_env
=
GmeiConfig
.
getSparkSession
()
val
sc
=
spark_env
.
_2
sc
.
sql
(
"use jerry_prod"
)
val
stat_date
=
GmeiConfig
.
getMinusNDate
(
1
)
// val stat_date = param.date
//println(param.date)
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
megou_click
=
sc
.
sql
(
s
"""
|SELECT partition_date,device_id,service_id
|from online.ml_meigou_order_detail
|where partition_date='${partition_date}'
"""
.
stripMargin
)
megou_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