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
31f13811
Commit
31f13811
authored
Jun 23, 2019
by
pengfei.x
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
colloct to master and pritn
parent
ddfb9a71
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
23 deletions
+25
-23
workspace.xml
.idea/workspace.xml
+0
-0
pvCheker.scala
src/main/scala/com/gmei/data/dq/pvCheker.scala
+25
-23
No files found.
.idea/workspace.xml
View file @
31f13811
This diff is collapsed.
Click to expand it.
src/main/scala/com/gmei/data/dq/pvCheker.scala
View file @
31f13811
...
@@ -8,7 +8,7 @@ case class Record(page_name: String, flag: Int, cl_type: String, count: Int)
...
@@ -8,7 +8,7 @@ case class Record(page_name: String, flag: Int, cl_type: String, count: Int)
object
pvReferCheker
{
object
pvReferCheker
{
def
validateRefer
(
page_name
:
String
,
d
:
Iterable
[(
Int
,
String
,
Int
)])
=
{
def
validateRefer
(
page_name
:
String
,
d
:
Iterable
[(
Int
,
String
,
Long
)])
:
String
=
{
// demo data
// demo data
/*
/*
about_me_message_list 0 ios 335
about_me_message_list 0 ios 335
...
@@ -25,19 +25,21 @@ object pvReferCheker {
...
@@ -25,19 +25,21 @@ object pvReferCheker {
all_sort 0 android 639
all_sort 0 android 639
*/
*/
if
(
d
.
size
==
1
||
(
d
.
size
==
2
&&
d
.
head
.
_1
==
d
.
last
.
_1
))
{
if
(
d
.
size
==
1
||
(
d
.
size
==
2
&&
d
.
head
.
_1
==
d
.
last
.
_1
))
{
println
(
s
"$page_name seems good!"
)
s
"$page_name seems good!"
}
else
if
(
d
.
size
==
3
)
{
}
else
if
(
d
.
size
==
3
)
{
val
ps
=
d
.
partition
(
_
.
_2
==
"ios"
)
val
ps
=
d
.
partition
(
_
.
_2
==
"ios"
)
if
(
ps
.
_1
.
size
==
1
)
if
(
ps
.
_1
.
size
==
1
)
println
(
s
"$page_name ${ps._2.head._2} client seems bad!"
)
s
"$page_name ${ps._2.head._2} client seems bad!"
else
else
println
(
s
"$page_name ${ps._1.head._2} client seems bad!"
)
s
"$page_name ${ps._1.head._2} client seems bad!"
}
else
if
(
d
.
size
==
4
)
{
}
else
if
(
d
.
size
==
4
)
{
val
ps
=
d
.
partition
(
_
.
_2
==
"ios"
)
val
ps
=
d
.
partition
(
_
.
_2
==
"ios"
)
if
(
ps
.
_1
.
head
.
_3
/
ps
.
_1
.
last
.
_3
>
ps
.
_2
.
head
.
_3
/
ps
.
_1
.
last
.
_3
)
if
(
ps
.
_1
.
head
.
_3
/
ps
.
_1
.
last
.
_3
>
ps
.
_2
.
head
.
_3
/
ps
.
_1
.
last
.
_3
)
println
(
s
"$page_name client ${ps._1.head._2} seems bad!"
)
s
"$page_name client ${ps._1.head._2} seems bad!"
else
else
println
(
s
"$page_name client ${ps._2.head._2} seems bad!"
)
s
"$page_name client ${ps._2.head._2} seems bad!"
}
else
{
s
"$page_name ok"
}
}
}
}
...
@@ -47,31 +49,31 @@ object pvReferCheker {
...
@@ -47,31 +49,31 @@ object pvReferCheker {
val
vault
:
Int
=
0
val
vault
:
Int
=
0
val
x
=
sc
.
sql
(
val
x
=
sc
.
sql
(
s
"""
s
"""
|select * from (
|select
| select
| params['page_name'] as page_name,
| params['page_name'] as page_name,
| (case when params['referrer'] = '' or params['referrer'] is null then 0 else 1 end) as has_referrer,
| (case when params['referrer'] = '' or params['referrer'] is null then 0 else 1 end) as has_referrer,
| cl_type,
| cl_type,
| count(1) as c
| count(1) as c,
|from
| from
| online.bl_hdfs_maidian_updates
| online.tl_hdfs_maidian_view
|where
| where
| partition_date = '$partition_date' and action = 'page_view'
| partition_date = '$partition_date' and action = 'page_view'
|group by
| group by
| params['page_name'],
| params['page_name'],
| (case when params['referrer'] = '' or params['referrer'] is null then 0 else 1 end),
| (case when params['referrer'] = '' or params['referrer'] is null then 0 else 1 end),
| cl_type
| cl_type
|order by params['page_name']
|) c
|order by c.page_name
"""
.
stripMargin
)
"""
.
stripMargin
)
val
y
=
x
.
rdd
.
map
{
val
y
=
x
.
rdd
.
map
{
case
Row
(
page_name
:
String
,
has_referrer
:
Int
,
cl_type
:
String
,
c
:
Int
)
=>
{
case
Row
(
page_name
:
String
,
has_referrer
:
Int
,
cl_type
:
String
,
c
:
Long
)
=>
{
page_name
->
(
has_referrer
,
cl_type
,
c
)
page_name
->
(
has_referrer
,
cl_type
,
c
)
}
}
}
}
val
z
=
y
.
groupByKey
().
map
{
val
z
=
y
.
groupByKey
().
map
{
case
(
p
,
v
)
=>
validateRefer
(
p
,
v
)
case
(
p
,
v
)
=>
validateRefer
(
p
,
v
)
}
}
z
.
collect
.
foreach
{
println
}
}
}
}
}
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