-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdc_schema.js
More file actions
166 lines (124 loc) · 8.4 KB
/
dc_schema.js
File metadata and controls
166 lines (124 loc) · 8.4 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
'use strict';
const _ = require('lodash');
const DAU_FIELD_LIST = [
{ name: "app", length: 16, type: "string", is_null: false, default: "" },
{ name: "app_ver", length: 16, type: "string", is_null: false, default: "" },
{ name: "server_ver", length: 16, type: "string", is_null: true, default: null },
{ name: "config_ver", length: 16, type: "string", is_null: true, default: null },
{ name: "ingest_datetime", length: 0, type: "datetime", is_null: true, default: null },
{ name: "event_datetime", length: 0, type: "datetime", is_null: false, default: "" },
{ name: "device_tag", length: 64, type: "string", is_null: false, default: "" },
{ name: "device_type", length: 32, type: "string", is_null: false, default: "" },
{ name: "device_family", length: 32, type: "string", is_null: true, default: null },
{ name: "user_map_tag", length: 64, type: "string", is_null: false, default: "" },
{ name: "os", length: 16, type: "string", is_null: false, default: "" },
{ name: "os_ver", length: 16, type: "string", is_null: false, default: "" },
{ name: "browser", length: 16, type: "string", is_null: true, default: null },
{ name: "browser_ver", length: 16, type: "string", is_null: true, default: null },
{ name: "marketplace", length: 16, type: "string", is_null: true, default: null },
{ name: "country", length: 2, type: "string", is_null: false, default: "ZZ" },
{ name: "language", length: 5, type: "string", is_null: false, default: "" },
{ name: "online_status", length: 16, type: "string", is_null: true, default: null },
{ name: "group_tag", length: 64, type: "string", is_null: true, default: null },
{ name: "kingdom", length: 32, type: "string", is_null: true, default: null },
{ name: "phylum", length: 32, type: "string", is_null: true, default: null },
{ name: "class", length: 32, type: "string", is_null: true, default: null },
{ name: "order", length: 32, type: "string", is_null: true, default: null },
{ name: "family", length: 32, type: "string", is_null: true, default: null },
{ name: "genus", length: 32, type: "string", is_null: true, default: null },
{ name: "species", length: 32, type: "string", is_null: true, default: null },
{ name: "float1", length: 0, type: "float", is_null: false, default: 0.0 },
{ name: "float2", length: 0, type: "float", is_null: false, default: 0.0 },
{ name: "float3", length: 0, type: "float", is_null: false, default: 0.0 },
{ name: "float4", length: 0, type: "float", is_null: false, default: 0.0 },
{ name: "event_index", length: 0, type: "int", is_null: true, default: null },
];
const INSTALL_FIELD_LIST = _.union(DAU_FIELD_LIST,
[
{ name: "is_attributed", length: 0, type: "boolean", is_null: false, default: 0 },
]);
const ECONOMY_FIELD_LIST = _.union(DAU_FIELD_LIST,
[
{ name: "spend_amount", length: 0, type: "float", is_null: false, default: 0.0 },
{ name: "spend_currency", length: 16, type: "string", is_null: false, default: "" },
{ name: "spend_type", length: 16, type: "string", is_null: true, default: null },
]);
const MSG_SEND_FIELD_LIST = [
{ name: "app", length: 16, type: "string", is_null: false, default: "" },
{ name: "app_ver", length: 16, type: "string", is_null: false, default: "" },
{ name: "server_ver", length: 16, type: "string", is_null: true, default: null },
{ name: "config_ver", length: 16, type: "string", is_null: true, default: null },
{ name: "ingest_datetime", length: 0, type: "datetime", is_null: true, default: null },
{ name: "event_datetime", length: 0, type: "datetime", is_null: false, default: "" },
{ name: "device_tag", length: 64, type: "string", is_null: false, default: "" },
{ name: "device_type", length: 32, type: "string", is_null: false, default: "" },
{ name: "device_family", length: 32, type: "string", is_null: true, default: null },
{ name: "user_map_tag", length: 64, type: "string", is_null: false, default: "" },
{ name: "os", length: 16, type: "string", is_null: false, default: "" },
{ name: "os_ver", length: 16, type: "string", is_null: false, default: "" },
{ name: "browser", length: 16, type: "string", is_null: true, default: null },
{ name: "browser_ver", length: 16, type: "string", is_null: true, default: null },
{ name: "marketplace", length: 16, type: "string", is_null: true, default: null },
{ name: "country", length: 2, type: "string", is_null: false, default: "ZZ" },
{ name: "language", length: 5, type: "string", is_null: false, default: "" },
{ name: "group_tag", length: 64, type: "string", is_null: true, default: null },
{ name: "kingdom", length: 32, type: "string", is_null: true, default: null },
{ name: "phylum", length: 32, type: "string", is_null: true, default: null },
{ name: "class", length: 32, type: "string", is_null: true, default: null },
{ name: "order", length: 32, type: "string", is_null: true, default: null },
{ name: "family", length: 32, type: "string", is_null: true, default: null },
{ name: "genus", length: 32, type: "string", is_null: true, default: null },
{ name: "species", length: 32, type: "string", is_null: true, default: null },
{ name: "float1", length: 0, type: "float", is_null: false, default: 0.0 },
{ name: "float2", length: 0, type: "float", is_null: false, default: 0.0 },
{ name: "float3", length: 0, type: "float", is_null: false, default: 0.0 },
{ name: "float4", length: 0, type: "float", is_null: false, default: 0.0 },
{ name: "network", length: 16, type: "string", is_null: false, default: "" },
{ name: "channel", length: 16, type: "string", is_null: true, default: null },
{ name: "from_tag", length: 64, type: "string", is_null: false, default: "" },
{ name: "to_tag", length: 64, type: "string", is_null: false, default: "" },
{ name: "event_index", length: 0, type: "int", is_null: true, default: null },
];
const EXPERIMENT_STAGING_FIELD_LIST = [
{ name: "app", length: 16, type: "string", is_null: false, default: "" },
{ name: "app_ver", length: 16, type: "string", is_null: false, default: "" },
{ name: "server_ver", length: 16, type: "string", is_null: true, default: null },
{ name: "config_ver", length: 16, type: "string", is_null: true, default: null },
{ name: "event_datetime", length: 0, type: "datetime", is_null: false, default: "" },
{ name: "device_tag", length: 64, type: "string", is_null: false, default: "" },
{ name: "experiment_name", length: 32, type: "string", is_null: false, default: "" },
{ name: "variant_name", length: 32, type: "string", is_null: false, default: "" },
];
const APP_LOG_FIELD_LIST = [
{ name: "app", length: 16, type: "string", is_null: false, default: "" },
{ name: "app_ver", length: 16, type: "string", is_null: false, default: "" },
{ name: "ingest_datetime", length: 0, type: "datetime", is_null: true, default: null },
{ name: "event_datetime", length: 0, type: "datetime", is_null: false, default: "" },
{ name: "hostname", length: 64, type: "string", is_null: true, default: null },
{ name: "filename", length: 256, type: "string", is_null: true, default: null },
{ name: "log_level", length: 16, type: "string", is_null: true, default: null },
{ name: "device_tag", length: 64, type: "string", is_null: true, default: null },
{ name: "user_tag", length: 64, type: "string", is_null: true, default: null },
{ name: "remote_address", length: 64, type: "string", is_null: true, default: null },
{ name: "response_bytes", length: 0, type: "int", is_null: true, default: null },
{ name: "response_ms", length: 0, type: "float", is_null: true, default: null },
{ name: "device_type", length: 32, type: "string", is_null: true, default: null },
{ name: "os", length: 16, type: "string", is_null: true, default: null },
{ name: "os_ver", length: 16, type: "string", is_null: true, default: null },
{ name: "browser", length: 16, type: "string", is_null: true, default: null },
{ name: "browser_ver", length: 16, type: "string", is_null: true, default: null },
{ name: "country", length: 2, type: "string", is_null: true, default: null },
{ name: "language", length: 5, type: "string", is_null: true, default: null },
{ name: "log_line", length: 65535, type: "string", is_null: true, default: null },
];
const TABLE_MAP = {
install: INSTALL_FIELD_LIST,
dau: DAU_FIELD_LIST,
event: DAU_FIELD_LIST,
economy: ECONOMY_FIELD_LIST,
message_send: MSG_SEND_FIELD_LIST,
message_click: MSG_SEND_FIELD_LIST,
experiment: EXPERIMENT_STAGING_FIELD_LIST,
app_log: APP_LOG_FIELD_LIST,
};
exports.TABLE_MAP = TABLE_MAP;