-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpresto-tables-example.json
149 lines (144 loc) · 5.06 KB
/
presto-tables-example.json
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
[
/* This is an example of a simple table that will try to dynamically guess
column types. */
{
// NDJSON - new line delimited JSON
"dataFileType": "NDJSON",
// File filter regex that will ensure that only *.log files are queried
"filterRegex": "^.*\\.log",
// Directory filter regex that will allow you to filter directories.
// This is useful because it will allow you to reduce the search space
// earlier than a file filter.
"directoryFilterRegex": "",
// Path that will be recursively searched for data files
"rootPath": "~~/stor/presto/json-examples",
// Unique name of table
"name": "json-examples-1"
},
/* This is an example of a table with a hardcoded-data format (Telegraf JSON).
The columns in this table are predefined. */
{
// TELEGRAF_NDJSON - Telegraf format JSON file
"dataFileType": "TELEGRAF_NDJSON",
// File filter regex that will ensure that only *.log files are queried
"filterRegex": "^.*\\.log",
// Directory filter regex that will allow you to filter directories.
// This is useful because it will allow you to reduce the search space
// earlier than a file filter.
"directoryFilterRegex": "",
// Path that will be recursively searched for data files
"rootPath": "~~/stor/presto/json-examples",
// Unique name of table
"name": "json-examples-2"
},
/* This is an example of a table with explicitly defined columns.
The columns in this table are defined below. */
{
// NDJSON - new line delimited JSON
"dataFileType": "NDJSON",
// File filter regex that will ensure that only *.log files are queried
"filterRegex": "^.*\\.log",
// Directory filter regex that will allow you to filter directories.
// This is useful because it will allow you to reduce the search space
// earlier than a file filter.
"directoryFilterRegex": "",
// Path that will be recursively searched for data files
"rootPath": "~~/stor/presto/json-examples",
// Unique name of table
"name": "json-examples-3",
// Column definition
"columns": [
{
// Name of column to read from JSON object
"name": "name",
// Presto compatibile data type name
"type": "varchar"
},
{
"name": "timestamp",
"type": "timestamp",
// Format can be used to specify specific data formats the type should
// be read from
"format": "epoch-seconds"
},
{
"name": "count",
"type": "int"
},
{
// Freeform JSON objects are also supported
"type": "json",
"name": "properties"
}
]
},
/* This is an example of a table with file and server partitioning. */
{
// NDJSON - new line delimited JSON
"dataFileType": "NDJSON",
// File filter regex that will ensure that only *.log files are queried
"filterRegex": "^.*\\.log",
// Directory filter regex that will allow you to filter directories.
// This is useful because it will allow you to reduce the search space
// earlier than a file filter.
"directoryFilterRegex": "",
// Path that will be recursively searched for data files
"rootPath": "~~/stor/presto/json-examples",
// Unique name of table
"name": "json-examples-4",
// Column definition
"columns": [
{
// Name of column to read from JSON object
"name": "name",
// Presto compatibile data type name
"type": "varchar",
"comment":"Metric Recorded"
},
{
"name": "timestamp",
"type": "timestamp",
// Format can be used to specify specific data formats the type should
// be read from
"format": "epoch-seconds"
},
{
"name": "count",
"type": "int"
},
{
// Freeform JSON objects are also supported
"name": "properties",
"type": "json"
},
{
"name": "user",
"type": "varchar",
// Hidden columns are also supported
"hidden": true
}
],
// Parititioning on file names or directory directory names can be enabled
// such that each partition is presented as a column in which you can
// do WHERE operations upon.
"partitioning": {
// File partitions are specified as a regex with each group being a partition.
"filterRegex": "^/user/stor/json-examples/.+/(.+)-(.+)-(.+)-.+\\.log$",
// Here you define the name of the partition. Each item corresponds to
// a group within the regex in the order of appearence from left to right.
"partitions": [
"year",
"month",
"day"
],
// Directory partitions are specified as a regex with each group being a partition.
// They are useful because they can quickly reduce the overall search space.
"directoryFilterRegex": "^/user/stor/json-examples/(.+)/.+\\.log$",
// Like file partitions directory partition names are defined such that
// each partition name corresponds to a single partition group
"directoryPartitions": [
"server"
]
}
}
]