Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bi-report
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
bi-report
Commits
27bb383a
Commit
27bb383a
authored
May 03, 2020
by
赵建伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update codes
parent
c026d226
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
117 additions
and
3 deletions
+117
-3
hive2csv.sh
lib/shell/hive2csv.sh
+1
-1
hive2hive.sh
lib/shell/hive2hive.sh
+1
-1
sparksql2email.sh
lib/shell/sparksql2email.sh
+1
-1
demo.sql
sqls/shell/demo.sql
+18
-0
demo_param.sql
sqls/shell/demo_param.sql
+96
-0
No files found.
lib/shell/hive2csv.sh
View file @
27bb383a
...
...
@@ -47,7 +47,7 @@ echo "V_7DAY_M_D_AGO: "$V_7DAY_M_D_AGO
echo
"************************************"
echo
""
cp
"/home/bi/bi-report/sqls/
"
$1
"
/"
$1
".sql"
$tmp_file_name
cp
"/home/bi/bi-report/sqls/
shell
/"
$1
".sql"
$tmp_file_name
sed
-i
"s/
\$
V_PARYMD/
$V_PARYMD
/g"
$tmp_file_name
sed
-i
"s/
\$
V_PARY_M_D/
$V_PARY_M_D
/g"
$tmp_file_name
sed
-i
"s/
\$
V_1DAYMD_AGO/
$V_1DAYMD_AGO
/g"
$tmp_file_name
...
...
lib/shell/hive2hive.sh
View file @
27bb383a
...
...
@@ -45,7 +45,7 @@ echo "V_7DAY_M_D_AGO: "$V_7DAY_M_D_AGO
echo
"************************************"
echo
""
cp
"/home/bi/bi-report/sqls/
"
$1
"
/"
$1
".sql"
$tmp_file_name
cp
"/home/bi/bi-report/sqls/
shell
/"
$1
".sql"
$tmp_file_name
sed
-i
"s/
\$
V_PARYMD/
$V_PARYMD
/g"
$tmp_file_name
sed
-i
"s/
\$
V_PARY_M_D/
$V_PARY_M_D
/g"
$tmp_file_name
sed
-i
"s/
\$
V_1DAYMD_AGO/
$V_1DAYMD_AGO
/g"
$tmp_file_name
...
...
lib/shell/sparksql2email.sh
View file @
27bb383a
...
...
@@ -47,7 +47,7 @@ echo "V_7DAY_M_D_AGO: "$V_7DAY_M_D_AGO
echo
"************************************"
echo
""
cp
"/home/bi/bi-report/sqls/
"
$1
"
/"
$1
".sql"
$tmp_file_name
cp
"/home/bi/bi-report/sqls/
shell
/"
$1
".sql"
$tmp_file_name
sed
-i
"s/
\$
V_PARYMD/
$V_PARYMD
/g"
$tmp_file_name
sed
-i
"s/
\$
V_PARY_M_D/
$V_PARY_M_D
/g"
$tmp_file_name
sed
-i
"s/
\$
V_1DAYMD_AGO/
$V_1DAYMD_AGO
/g"
$tmp_file_name
...
...
sqls/shell/demo.sql
0 → 100644
View file @
27bb383a
SELECT
partition_date
,
device_os_type
AS
device_type
,
CASE
WHEN
active_type
=
'4'
THEN
'老活'
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增'
END
AS
active_type
,
device_id
FROM
online
.
ml_device_day_active_status
WHERE
partition_date
between
'20200401'
and
'20200408'
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
limit
10
\ No newline at end of file
sqls/shell/demo_param.sql
0 → 100644
View file @
27bb383a
select
t6
.
new_tag_name
,
--新标签name
t6
.
new_tag_type
,
--新标签type
t6
.
new_tag_id
,
--新标签id
t6
.
is_display
,
--是否在app展示
t6
.
is_online
,
--是否生效
collect_set
(
t6
.
jianyi_word
)
as
jianyi_word
,
--近义词
collect_set
(
t6
.
like_new_tag
)
as
tongyi_word
,
--同义词
collect_set
(
t6
.
fangshi_1f
)
as
fangshi_1st
,
--一级方式_name
collect_set
(
t6
.
fangshi_2d
)
as
fangshi_2nd
,
--二级方式_name
collect_set
(
t6
.
suqiu_1f
)
as
suqiu_1st
,
--一级诉求_name
collect_set
(
t6
.
suqiu_2d
)
as
suqiu_2nd
,
--二级诉求_name
collect_set
(
t6
.
buwei_if
)
as
buwei_1st
,
--一级部位_name
collect_set
(
t6
.
buwei_2d
)
as
buwei_2nd
,
--二级部位_name
collect_set
(
t6
.
old_tag_name
)
as
old_tag_name
,
--老标签_name
collect_set
(
t6
.
old_tag_type
)
as
old_tag_type
,
--老标签_type
collect_set
(
t6
.
old_tag_id
)
as
old_tag_id
,
--老标签_id
collect_set
(
t6
.
fangshi_1f_id
)
as
fangshi_1st_id
,
--一级方式_id
collect_set
(
t6
.
fangshi_2d_id
)
as
fangshi_2nd_id
,
--二级方式_id
collect_set
(
t6
.
suqiu_1f_id
)
as
suqiu_1st_id
,
--一级诉求_id
collect_set
(
t6
.
suqiu_2d_id
)
as
suqiu_2nd_id
,
--二级诉求_id
collect_set
(
t6
.
buwei_if_id
)
as
buwei_1st_id
,
--一级部位_id
collect_set
(
t6
.
buwei_2d_id
)
as
buwei_2nd_id
--二级部位_id
from
(
select
t1
.
name
as
new_tag_name
,
--新标签name
t1
.
tag_type
as
new_tag_type
,
--新标签type
t1
.
id
as
new_tag_id
,
--新标签id
t1
.
is_display
as
is_display
,
--是否在app展示
t1
.
is_online
as
is_online
,
--是否生效
t1
.
homoionym
as
jianyi_word
,
--近义词
t2
.
name
as
like_new_tag
,
--同义词
t4
.
aggregate_type
,
--对应类型的枚举值
(
case
when
t4
.
aggregate_type
=
'6'
then
t4
.
name
else
NULL
end
)
as
fangshi_1f
,
--一级方式_name
(
case
when
t4
.
aggregate_type
=
'2'
then
t4
.
name
else
NULL
end
)
as
fangshi_2d
,
--二级方式_name
(
case
when
t4
.
aggregate_type
=
'7'
then
t4
.
name
else
NULL
end
)
as
suqiu_1f
,
--一级诉求_name
(
case
when
t4
.
aggregate_type
=
'8'
then
t4
.
name
else
NULL
end
)
as
suqiu_2d
,
--二级诉求_name
(
case
when
t4
.
aggregate_type
=
'10'
then
t4
.
name
else
NULL
end
)
as
buwei_if
,
--一级部位_name
(
case
when
t4
.
aggregate_type
=
'3'
then
t4
.
name
else
NULL
end
)
as
buwei_2d
,
--二级部位_name
t7
.
old_tag_name
as
old_tag_name
,
--老标签_name
t7
.
old_tag_type
as
old_tag_type
,
--老标签_type
t5
.
old_tag_id
as
old_tag_id
,
--老标签_id
(
case
when
t4
.
aggregate_type
=
'6'
then
t4
.
id
else
NULL
end
)
as
fangshi_1f_id
,
--一级方式_id
(
case
when
t4
.
aggregate_type
=
'2'
then
t4
.
id
else
NULL
end
)
as
fangshi_2d_id
,
--二级方式_id
(
case
when
t4
.
aggregate_type
=
'7'
then
t4
.
id
else
NULL
end
)
as
suqiu_1f_id
,
--一级诉求_id
(
case
when
t4
.
aggregate_type
=
'8'
then
t4
.
id
else
NULL
end
)
as
suqiu_2d_id
,
--二级诉求_id
(
case
when
t4
.
aggregate_type
=
'10'
then
t4
.
id
else
NULL
end
)
as
buwei_if_id
,
--一级部位_id
(
case
when
t4
.
aggregate_type
=
'3'
then
t4
.
id
else
NULL
end
)
as
buwei_2d_id
--二级部位_id
from
(
select
name
,
id
,
is_display
,
is_online
,
case
when
tag_type
in
(
'1'
)
then
'普通分类'
when
tag_type
in
(
'2'
)
then
'一级分类'
when
tag_type
in
(
'3'
)
then
'二级分类'
end
as
tag_type
,
collect_list
(
t1
.
homoionym_detail
)
as
homoionym
from
online
.
tl_hdfs_api_tag_3_0_view
--新标签id,近义词
lateral
view
explode
(
json_split
(
homoionym
))
t1
as
homoionym_detail
--["\u8138\u578b\u77eb\u6b63"]转义 json_split
where
partition_date
=
'$V_PARYMD'
group
by
name
,
id
,
is_display
,
is_online
,
case
when
tag_type
in
(
'1'
)
then
'普通分类'
when
tag_type
in
(
'2'
)
then
'一级分类'
when
tag_type
in
(
'3'
)
then
'二级分类'
end
)
t1
left
join
(
select
name
,
tag_id
from
online
.
tl_hdfs_api_tag_aggregate_view
where
partition_date
=
'$V_PARYMD'
)
t2
--新标签id,同义词
on
(
t1
.
id
=
t2
.
tag_id
)
left
join
(
select
tag_attr_id
as
tag_ids
,
tag_id
from
online
.
tl_hdfs_api_tag_attr_tag_view
where
partition_date
=
'$V_PARYMD'
)
t3
--新标签id,属性ids
on
(
t1
.
id
=
t3
.
tag_id
)
left
join
(
select
name
,
id
,
aggregate_type
from
online
.
tl_hdfs_api_tag_attr_view
where
partition_date
=
'$V_PARYMD'
)
t4
--属性id,属性分类
on
(
t3
.
tag_ids
=
t4
.
id
)
left
join
(
select
old_tag_id
,
tag_id
from
online
.
tl_hdfs_api_tag_map_oldtag_view
where
partition_date
=
'$V_PARYMD'
)
t5
on
(
t1
.
id
=
t5
.
tag_id
)
left
join
(
select
id
,
name
as
old_tag_name
,
case
when
tag_type
in
(
'1'
)
then
'一级分类'
when
tag_type
in
(
'2'
)
then
'二级分类'
when
tag_type
in
(
'3'
)
then
'三级分类'
when
tag_type
in
(
'4'
)
then
'城市'
when
tag_type
in
(
'5'
)
then
'自由添加'
when
tag_type
in
(
'6'
)
then
'医生'
when
tag_type
in
(
'7'
)
then
'医院'
when
tag_type
in
(
'8'
)
then
'频道'
when
tag_type
in
(
'9'
)
then
'省份'
when
tag_type
in
(
'10'
)
then
'国家'
when
tag_type
in
(
'11'
)
then
'运营标签'
end
as
old_tag_type
from
online
.
tl_hdfs_api_tag_view
where
partition_date
=
'$V_PARYMD'
)
t7
on
(
t7
.
id
=
t5
.
old_tag_id
)
)
t6
group
by
t6
.
new_tag_name
,
t6
.
new_tag_type
,
t6
.
new_tag_id
,
t6
.
is_display
,
t6
.
is_online
\ No newline at end of file
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