Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tkdm
Project
Overview
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
etl
tkdm
Commits
cab31be3
Commit
cab31be3
authored
Mar 07, 2017
by
mengdongxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new file
parent
606d9296
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
0 deletions
+107
-0
tkdm_base_active_payment_info.sql
tkdm_base_active_payment_info.sql
+107
-0
No files found.
tkdm_base_active_payment_info.sql
0 → 100644
View file @
cab31be3
set
hive
.
skewjoin
.
key
=
10000
;
set
hive
.
optimize
.
skewjoin
=
true
;
set
hive
.
input
.
format
=
org
.
apache
.
hadoop
.
hive
.
ql
.
io
.
BucketizedHiveInputFormat
;
set
hive
.
optimize
.
bucketmapjoin
=
true
;
set
hive
.
optimize
.
bucketmapjoin
.
sortedmerge
=
true
;
set
hive
.
merge
.
mapredfiles
=
true
;
set
hive
.
auto
.
convert
.
sortmerge
.
join
=
true
;
insert
overwrite
table
tkdm
.
tkdm_base_active_payment_info
partition
(
ds
=
'2017-02-25'
)
select
x
.
deviceid
,
x
.
appid
,
x
.
cid
,
x
.
ins_date
,
x
.
category_id
,
x
.
isgame
,
x
.
platform
,
nvl
(
x
.
first_payment_ds
,
y
.
first_payment_ds
)
as
first_payment_ds
,
nvl
(
y
.
last_payment_ds
,
x
.
amt_payment_last
)
as
last_payment_ds
,
x
.
num_payment_cnt
+
y
.
num_payment_cnt
as
num_payment_cnt
,
x
.
num_payment_day
+
y
.
num_payment_day
as
num_payment_day
,
x
.
amt_payment
+
y
.
amt_payment
as
amt_payment
,
nvl
(
y
.
amt_payment
,
x
.
amt_payment_last
)
as
amt_payment_last
from
(
select
nvl
(
a
.
deviceid
,
b
.
deviceid
)
as
deviceid
,
nvl
(
a
.
appid
,
b
.
appid
)
as
appid
,
nvl
(
b
.
cid
,
a
.
cid
)
as
cid
,
nvl
(
b
.
ins_date
,
a
.
ins_date
)
as
ins_date
,
nvl
(
b
.
category_id
,
a
.
category_id
)
as
category_id
,
nvl
(
b
.
isgame
,
a
.
isgame
)
as
isgame
,
nvl
(
b
.
platform
,
a
.
platform
)
as
platform
,
a
.
first_payment_ds
,
a
.
last_payment_ds
,
nvl
(
a
.
num_payment_cnt
,
0
)
as
num_payment_cnt
,
nvl
(
a
.
num_payment_day
,
0
)
as
num_payment_day
,
nvl
(
a
.
amt_payment
,
0
)
amt_payment
,
nvl
(
a
.
amt_payment_last
,
0
)
as
amt_payment_last
from
(
select
deviceid
,
appid
,
cid
,
ins_date
,
category_id
,
isgame
,
platform
,
first_payment_ds
,
last_payment_ds
,
num_payment_cnt
,
num_payment_day
,
amt_payment
,
amt_payment_last
from
tkdm
.
tkdm_base_active_payment_info
where
ds
=
date_sub
(
'2017-02-25'
,
1
)
)
a
full
join
(
select
deviceid
,
appid
,
cid
,
ins_date
,
category_id
,
isgame
,
platform
from
tkdm
.
tkdm_data_active_detial_day
where
ds
=
'2017-02-25'
)
b
on
a
.
deviceid
=
b
.
deviceid
and
a
.
appid
=
b
.
appid
)
x
left
join
(
select
deviceid
,
appid
,
to_date
(
ins_datetime
)
as
ins_date
,
'2017-02-25'
as
first_payment_ds
,
'2017-02-25'
as
last_payment_ds
,
num_payment_cnt
,
1
as
num_payment_day
,
amt_payment
from
tkdm
.
tkdm_data_payment_detial_day
)
y
on
x
.
deviceid
=
y
.
deviceid
and
x
.
appid
=
y
.
appid
cluster
by
deviceid
,
appid
create
EXTERNAL
table
tkdm_base_active_payment_info
(
appid
string
,
deviceid
string
,
cid
int
,
ins_date
string
,
category_id
int
,
isgame
int
,
platform
string
,
first_payment_ds
string
,
last_payment_ds
string
,
num_payment_cnt
int
,
num_payment_day
int
,
amt_payment
double
,
amt_payment_last
double
)
PARTITIONED
BY
(
ds
string
)
clustered
by
(
deviceid
)
sorted
by
(
deviceid
,
appid
)
into
32
buckets
ROW
FORMAT
DELIMITED
FIELDS
TERMINATED
BY
'
\t
'
STORED
AS
ORC
location
's3://reyuntkio/warehouse/tkio/tkdm.db/tkdm_base_active_payment_info'
;
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