Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
data-dqmonitor
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
薛鹏飞
data-dqmonitor
Commits
1799f3a4
Commit
1799f3a4
authored
Jun 26, 2019
by
Pengfei Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dont group by app version
parent
4e10f4e5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
8 deletions
+11
-8
.gitignore
.gitignore
+1
-0
actionCheck.scala
src/main/scala/com/gmei/data/dq/actionCheck.scala
+10
-8
No files found.
.gitignore
View file @
1799f3a4
...
...
@@ -2,3 +2,4 @@
run.sh
*.log
target/
.idea/
src/main/scala/com/gmei/data/dq/actionCheck.scala
View file @
1799f3a4
...
...
@@ -27,33 +27,35 @@ object actionCheck {
val
df
=
sc
.
sql
(
s
"""
|select
| a.partition_date as
today
,
| a.partition_date as
date
,
| b.partition_date as yesterday,
| a.cl_type,
| a.app_version,
| a.action,
| a.c as todayCount,
| b.c as yesterdayCount,
| case when b.c = 0 then 1.0 else (a.c - b.c) * 1.0 / b.c end as chainRate
|from
|(
| select partition_date, cl_type, a
pp_version, a
ction, count(1) as c
| select partition_date, cl_type, action, count(1) as c
| from online.bl_hdfs_maidian_updates
| where partition_date = '${partition_date}'
| group by partition_date, cl_type, a
pp_version, a
ction
| group by partition_date, cl_type, action
|) a left join (
| select partition_date, cl_type, a
pp_version, a
ction, count(1) as c
| select partition_date, cl_type, action, count(1) as c
| from online.bl_hdfs_maidian_updates
| where partition_date = '${yesterday}'
| group by partition_date, cl_type, a
pp_version, a
ction
|) b on a.cl_type = b.cl_type and a.a
pp_version = b.app_version and a.a
ction = b.action
| group by partition_date, cl_type, action
|) b on a.cl_type = b.cl_type and a.action = b.action
"""
.
stripMargin
)
// write out to tidb
Class
.
forName
(
"com.mysql.jdbc.Driver"
)
val
prop
=
new
java
.
util
.
Properties
()
prop
.
put
(
"user"
,
"root"
)
prop
.
put
(
"password"
,
"3SYz54LS9#^9sBvC"
)
val
url
=
"jdbc:mysql://172.16.40.172:4000/jerry_test"
prop
.
put
(
"driver"
,
"com.mysql.jdbc.Driver"
)
val
url
=
"jdbc:mysql://172.16.40.172:4000/jerry_test?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true"
//df is a dataframe contains the data which you want to write.
df
.
write
.
mode
(
SaveMode
.
Append
).
jdbc
(
url
,
"maidian_action_check"
,
prop
)
}
...
...
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