· 8 years ago · Apr 04, 2018, 08:42 AM
1{
2 "object_type":"test",
3 "heartbeat":1496755564224,
4 "events":[
5 {
6 "timestamp":1496755582985,
7 "hostname":"hostname1",
8 "instance":"instance1",
9 "metrics_array":[
10 {
11 "metric_name":"metric1_1",
12 "metric_value":"value1_1"
13 }
14 ]
15 },
16 {
17 "timestamp":1496756626551,
18 "hostname":"hostname2",
19 "instance":"instance1",
20 "metrics_array":[
21 {
22 "metric_name":"metric2_1",
23 "metric_value":"value2_1"
24 }
25 ]
26 }
27 ]
28}
29
30set hive.support.sql11.reserved.keywords=false;
31
32CREATE DATABASE IF NOT EXISTS datalake;
33
34DROP TABLE IF EXISTS datalake.test;
35
36CREATE EXTERNAL TABLE IF NOT EXISTS datalake.test
37 (
38 object_type STRING,
39 heartbeat BIGINT,
40 events STRUCT <
41 metrics_array: STRUCT <
42 metric_name: STRING,
43 metric_value: STRING
44 >,
45 timestamp: BIGINT,
46 hostname: STRING,
47 instance: STRING
48 >
49)
50STORED AS PARQUET
51LOCATION '/tmp/test/';