-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathxiaohua_code_from_train.sql
More file actions
114 lines (81 loc) · 2.93 KB
/
Copy pathxiaohua_code_from_train.sql
File metadata and controls
114 lines (81 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
-- education_code
-- position_code
-- workYears_code
-- contactsRelationship_code
-- bankCardName_code
-- ipCity_code
-- mobileCity_code
-- ipProvince_code
use ${hiveconf:source_database};
drop table if exists education_code;
create table education_code as
select t.event_education,
row_number() over(
order by t.event_education) as event_education_code
from
(select distinct event_education as event_education
from ${hiveconf:source_table}
where event_education is not null) t;
drop table if exists position_code;
create table position_code as
select t.event_position,
row_number() over(
order by t.event_position) as event_position_code
from
(select distinct event_position as event_position
from ${hiveconf:source_table}
where event_position is not null) t;
drop table if exists workYears_code;
create table workYears_code as
select t.event_workyears,
row_number() over(
order by t.event_workyears) as event_workyears_code
from
(select distinct event_workyears as event_workyears
from ${hiveconf:source_table}
where event_workyears is not null) t;
drop table if exists contactsRelationship_code;
create table contactsRelationship_code as
select t.event_contactsrelationship,
row_number() over(
order by t.event_contactsrelationship) as event_contactsrelationship_code
from
(select distinct event_contactsrelationship as event_contactsrelationship
from ${hiveconf:source_table}
where event_contactsrelationship is not null) t;
drop table if exists bankCardName_code;
create table bankCardName_code as
select t.event_bankCardName,
row_number() over(
order by t.event_bankcardname) as event_bankcardname_code
from
(select distinct event_bankcardname as event_bankcardname
from ${hiveconf:source_table}
where event_bankcardname is not null) t;
drop table if exists ipCity_code;
create table ipCity_code as
select t.event_ipCity,
row_number() over(
order by t.event_ipcity) as event_ipcity_code
from
(select distinct event_ipcity as event_ipcity
from ${hiveconf:source_table}
where event_ipcity is not null) t;
drop table if exists mobileCity_code;
create table mobileCity_code as
select t.event_mobileCity,
row_number() over(
order by t.event_mobilecity) as event_mobilecity_code
from
(select distinct event_mobilecity as event_mobilecity
from ${hiveconf:source_table}
where event_mobilecity is not null) t;
drop table if exists ipProvince_code;
create table ipProvince_code as
select t.event_ipprovince,
row_number() over(
order by t.event_ipprovince) as event_ipprovince_code
from
(select distinct event_ipprovince as event_ipprovince
from ${hiveconf:source_table}
where event_ipprovince is not null) t;