forked from apache/incubator-spot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_flow_avro_parquet.hql
executable file
·72 lines (71 loc) · 2.69 KB
/
create_flow_avro_parquet.hql
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
SET hiveconf:huser;
SET hiveconf:dbname;
CREATE EXTERNAL TABLE IF NOT EXISTS ${hiveconf:dbname}.flow (
treceived STRING,
unix_tstamp BIGINT,
tryear INT,
trmonth INT,
trday INT,
trhour INT,
trminute INT,
trsec INT,
tdur FLOAT,
sip STRING,
dip STRING,
sport INT,
dport INT,
proto STRING,
flag STRING,
fwd INT,
stos INT,
ipkt BIGINT,
ibyt BIGINT,
opkt BIGINT,
obyt BIGINT,
input INT,
output INT,
sas INT,
das INT,
dtos INT,
dir INT,
rip STRING
)
PARTITIONED BY (y INT, m INT, d INT, h int)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ','
STORED AS PARQUET
LOCATION '${hiveconf:huser}/flow/hive'
TBLPROPERTIES ('avro.schema.literal'='{
"type": "record"
, "name": "FlowRecord"
, "namespace" : "com.cloudera.accelerators.flows.avro"
, "fields": [
{"name": "treceived", "type":["string", "null"]}
, {"name": "unix_tstamp", "type":["long", "null"]}
, {"name": "tryear", "type":["int", "null"]}
, {"name": "trmonth", "type":["int", "null"]}
, {"name": "trday", "type":["int", "null"]}
, {"name": "trhour", "type":["int", "null"]}
, {"name": "trminute", "type":["int", "null"]}
, {"name": "trsec", "type":["int", "null"]}
, {"name": "tdur", "type":["float", "null"]}
, {"name": "sip", "type":["string", "null"]}
, {"name": "sport", "type":["int", "null"]}
, {"name": "dip", "type":["string", "null"]}
, {"name": "dport", "type":["int", "null"]}
, {"name": "proto", "type":["string", "null"]}
, {"name": "flag", "type":["string", "null"]}
, {"name": "fwd", "type":["int", "null"]}
, {"name": "stos", "type":["int", "null"]}
, {"name": "ipkt", "type":["bigint", "null"]}
, {"name": "ibytt", "type":["bigint", "null"]}
, {"name": "opkt", "type":["bigint", "null"]}
, {"name": "obyt", "type":["bigint", "null"]}
, {"name": "input", "type":["int", "null"]}
, {"name": "output", "type":["int", "null"]}
, {"name": "sas", "type":["int", "null"]}
, {"name": "das", "type":["int", "null"]}
, {"name": "dtos", "type":["int", "null"]}
, {"name": "dir", "type":["int", "null"]}
, {"name": "rip", "type":["string", "null"]}
]
}');