rbhive 0.2.95 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,253 +1,261 @@
1
1
  #
2
- # Autogenerated by Thrift
2
+ # Autogenerated by Thrift Compiler (0.9.0)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
6
6
 
7
+ require 'thrift'
7
8
 
8
- module AdjacencyType
9
- CONJUNCTIVE = 0
10
- DISJUNCTIVE = 1
11
- VALUE_MAP = {0 => "CONJUNCTIVE", 1 => "DISJUNCTIVE"}
12
- VALID_VALUES = Set.new([CONJUNCTIVE, DISJUNCTIVE]).freeze
13
- end
9
+ module Hive
10
+ module Thrift
11
+ module AdjacencyType
12
+ CONJUNCTIVE = 0
13
+ DISJUNCTIVE = 1
14
+ VALUE_MAP = {0 => "CONJUNCTIVE", 1 => "DISJUNCTIVE"}
15
+ VALID_VALUES = Set.new([CONJUNCTIVE, DISJUNCTIVE]).freeze
16
+ end
14
17
 
15
- module NodeType
16
- OPERATOR = 0
17
- STAGE = 1
18
- VALUE_MAP = {0 => "OPERATOR", 1 => "STAGE"}
19
- VALID_VALUES = Set.new([OPERATOR, STAGE]).freeze
20
- end
18
+ module NodeType
19
+ OPERATOR = 0
20
+ STAGE = 1
21
+ VALUE_MAP = {0 => "OPERATOR", 1 => "STAGE"}
22
+ VALID_VALUES = Set.new([OPERATOR, STAGE]).freeze
23
+ end
21
24
 
22
- module OperatorType
23
- JOIN = 0
24
- MAPJOIN = 1
25
- EXTRACT = 2
26
- FILTER = 3
27
- FORWARD = 4
28
- GROUPBY = 5
29
- LIMIT = 6
30
- SCRIPT = 7
31
- SELECT = 8
32
- TABLESCAN = 9
33
- FILESINK = 10
34
- REDUCESINK = 11
35
- UNION = 12
36
- UDTF = 13
37
- LATERALVIEWJOIN = 14
38
- LATERALVIEWFORWARD = 15
39
- VALUE_MAP = {0 => "JOIN", 1 => "MAPJOIN", 2 => "EXTRACT", 3 => "FILTER", 4 => "FORWARD", 5 => "GROUPBY", 6 => "LIMIT", 7 => "SCRIPT", 8 => "SELECT", 9 => "TABLESCAN", 10 => "FILESINK", 11 => "REDUCESINK", 12 => "UNION", 13 => "UDTF", 14 => "LATERALVIEWJOIN", 15 => "LATERALVIEWFORWARD"}
40
- VALID_VALUES = Set.new([JOIN, MAPJOIN, EXTRACT, FILTER, FORWARD, GROUPBY, LIMIT, SCRIPT, SELECT, TABLESCAN, FILESINK, REDUCESINK, UNION, UDTF, LATERALVIEWJOIN, LATERALVIEWFORWARD]).freeze
41
- end
25
+ module OperatorType
26
+ JOIN = 0
27
+ MAPJOIN = 1
28
+ EXTRACT = 2
29
+ FILTER = 3
30
+ FORWARD = 4
31
+ GROUPBY = 5
32
+ LIMIT = 6
33
+ SCRIPT = 7
34
+ SELECT = 8
35
+ TABLESCAN = 9
36
+ FILESINK = 10
37
+ REDUCESINK = 11
38
+ UNION = 12
39
+ UDTF = 13
40
+ LATERALVIEWJOIN = 14
41
+ LATERALVIEWFORWARD = 15
42
+ HASHTABLESINK = 16
43
+ HASHTABLEDUMMY = 17
44
+ VALUE_MAP = {0 => "JOIN", 1 => "MAPJOIN", 2 => "EXTRACT", 3 => "FILTER", 4 => "FORWARD", 5 => "GROUPBY", 6 => "LIMIT", 7 => "SCRIPT", 8 => "SELECT", 9 => "TABLESCAN", 10 => "FILESINK", 11 => "REDUCESINK", 12 => "UNION", 13 => "UDTF", 14 => "LATERALVIEWJOIN", 15 => "LATERALVIEWFORWARD", 16 => "HASHTABLESINK", 17 => "HASHTABLEDUMMY"}
45
+ VALID_VALUES = Set.new([JOIN, MAPJOIN, EXTRACT, FILTER, FORWARD, GROUPBY, LIMIT, SCRIPT, SELECT, TABLESCAN, FILESINK, REDUCESINK, UNION, UDTF, LATERALVIEWJOIN, LATERALVIEWFORWARD, HASHTABLESINK, HASHTABLEDUMMY]).freeze
46
+ end
42
47
 
43
- module TaskType
44
- MAP = 0
45
- REDUCE = 1
46
- OTHER = 2
47
- VALUE_MAP = {0 => "MAP", 1 => "REDUCE", 2 => "OTHER"}
48
- VALID_VALUES = Set.new([MAP, REDUCE, OTHER]).freeze
49
- end
48
+ module TaskType
49
+ MAP = 0
50
+ REDUCE = 1
51
+ OTHER = 2
52
+ VALUE_MAP = {0 => "MAP", 1 => "REDUCE", 2 => "OTHER"}
53
+ VALID_VALUES = Set.new([MAP, REDUCE, OTHER]).freeze
54
+ end
50
55
 
51
- module StageType
52
- CONDITIONAL = 0
53
- COPY = 1
54
- DDL = 2
55
- MAPRED = 3
56
- EXPLAIN = 4
57
- FETCH = 5
58
- FUNC = 6
59
- MAPREDLOCAL = 7
60
- MOVE = 8
61
- VALUE_MAP = {0 => "CONDITIONAL", 1 => "COPY", 2 => "DDL", 3 => "MAPRED", 4 => "EXPLAIN", 5 => "FETCH", 6 => "FUNC", 7 => "MAPREDLOCAL", 8 => "MOVE"}
62
- VALID_VALUES = Set.new([CONDITIONAL, COPY, DDL, MAPRED, EXPLAIN, FETCH, FUNC, MAPREDLOCAL, MOVE]).freeze
63
- end
56
+ module StageType
57
+ CONDITIONAL = 0
58
+ COPY = 1
59
+ DDL = 2
60
+ MAPRED = 3
61
+ EXPLAIN = 4
62
+ FETCH = 5
63
+ FUNC = 6
64
+ MAPREDLOCAL = 7
65
+ MOVE = 8
66
+ STATS = 9
67
+ VALUE_MAP = {0 => "CONDITIONAL", 1 => "COPY", 2 => "DDL", 3 => "MAPRED", 4 => "EXPLAIN", 5 => "FETCH", 6 => "FUNC", 7 => "MAPREDLOCAL", 8 => "MOVE", 9 => "STATS"}
68
+ VALID_VALUES = Set.new([CONDITIONAL, COPY, DDL, MAPRED, EXPLAIN, FETCH, FUNC, MAPREDLOCAL, MOVE, STATS]).freeze
69
+ end
64
70
 
65
- class Adjacency
66
- include ::Thrift::Struct, ::Thrift::Struct_Union
67
- NODE = 1
68
- CHILDREN = 2
69
- ADJACENCYTYPE = 3
71
+ class Adjacency
72
+ include ::Thrift::Struct, ::Thrift::Struct_Union
73
+ NODE = 1
74
+ CHILDREN = 2
75
+ ADJACENCYTYPE = 3
70
76
 
71
- FIELDS = {
72
- NODE => {:type => ::Thrift::Types::STRING, :name => 'node'},
73
- CHILDREN => {:type => ::Thrift::Types::LIST, :name => 'children', :element => {:type => ::Thrift::Types::STRING}},
74
- ADJACENCYTYPE => {:type => ::Thrift::Types::I32, :name => 'adjacencyType', :enum_class => AdjacencyType}
75
- }
77
+ FIELDS = {
78
+ NODE => {:type => ::Thrift::Types::STRING, :name => 'node'},
79
+ CHILDREN => {:type => ::Thrift::Types::LIST, :name => 'children', :element => {:type => ::Thrift::Types::STRING}},
80
+ ADJACENCYTYPE => {:type => ::Thrift::Types::I32, :name => 'adjacencyType', :enum_class => ::Hive::Thrift::AdjacencyType}
81
+ }
76
82
 
77
- def struct_fields; FIELDS; end
83
+ def struct_fields; FIELDS; end
78
84
 
79
- def validate
80
- unless @adjacencyType.nil? || AdjacencyType::VALID_VALUES.include?(@adjacencyType)
81
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field adjacencyType!')
85
+ def validate
86
+ unless @adjacencyType.nil? || ::Hive::Thrift::AdjacencyType::VALID_VALUES.include?(@adjacencyType)
87
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field adjacencyType!')
88
+ end
89
+ end
90
+
91
+ ::Thrift::Struct.generate_accessors self
82
92
  end
83
- end
84
93
 
85
- ::Thrift::Struct.generate_accessors self
86
- end
94
+ class Graph
95
+ include ::Thrift::Struct, ::Thrift::Struct_Union
96
+ NODETYPE = 1
97
+ ROOTS = 2
98
+ ADJACENCYLIST = 3
87
99
 
88
- class Graph
89
- include ::Thrift::Struct, ::Thrift::Struct_Union
90
- NODETYPE = 1
91
- ROOTS = 2
92
- ADJACENCYLIST = 3
100
+ FIELDS = {
101
+ NODETYPE => {:type => ::Thrift::Types::I32, :name => 'nodeType', :enum_class => ::Hive::Thrift::NodeType},
102
+ ROOTS => {:type => ::Thrift::Types::LIST, :name => 'roots', :element => {:type => ::Thrift::Types::STRING}},
103
+ ADJACENCYLIST => {:type => ::Thrift::Types::LIST, :name => 'adjacencyList', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Hive::Thrift::Adjacency}}
104
+ }
93
105
 
94
- FIELDS = {
95
- NODETYPE => {:type => ::Thrift::Types::I32, :name => 'nodeType', :enum_class => NodeType},
96
- ROOTS => {:type => ::Thrift::Types::LIST, :name => 'roots', :element => {:type => ::Thrift::Types::STRING}},
97
- ADJACENCYLIST => {:type => ::Thrift::Types::LIST, :name => 'adjacencyList', :element => {:type => ::Thrift::Types::STRUCT, :class => Adjacency}}
98
- }
106
+ def struct_fields; FIELDS; end
99
107
 
100
- def struct_fields; FIELDS; end
108
+ def validate
109
+ unless @nodeType.nil? || ::Hive::Thrift::NodeType::VALID_VALUES.include?(@nodeType)
110
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field nodeType!')
111
+ end
112
+ end
101
113
 
102
- def validate
103
- unless @nodeType.nil? || NodeType::VALID_VALUES.include?(@nodeType)
104
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field nodeType!')
114
+ ::Thrift::Struct.generate_accessors self
105
115
  end
106
- end
107
-
108
- ::Thrift::Struct.generate_accessors self
109
- end
110
116
 
111
- class Operator
112
- include ::Thrift::Struct, ::Thrift::Struct_Union
113
- OPERATORID = 1
114
- OPERATORTYPE = 2
115
- OPERATORATTRIBUTES = 3
116
- OPERATORCOUNTERS = 4
117
- DONE = 5
118
- STARTED = 6
119
-
120
- FIELDS = {
121
- OPERATORID => {:type => ::Thrift::Types::STRING, :name => 'operatorId'},
122
- OPERATORTYPE => {:type => ::Thrift::Types::I32, :name => 'operatorType', :enum_class => OperatorType},
123
- OPERATORATTRIBUTES => {:type => ::Thrift::Types::MAP, :name => 'operatorAttributes', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}},
124
- OPERATORCOUNTERS => {:type => ::Thrift::Types::MAP, :name => 'operatorCounters', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::I64}},
125
- DONE => {:type => ::Thrift::Types::BOOL, :name => 'done'},
126
- STARTED => {:type => ::Thrift::Types::BOOL, :name => 'started'}
127
- }
128
-
129
- def struct_fields; FIELDS; end
130
-
131
- def validate
132
- unless @operatorType.nil? || OperatorType::VALID_VALUES.include?(@operatorType)
133
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field operatorType!')
117
+ class Operator
118
+ include ::Thrift::Struct, ::Thrift::Struct_Union
119
+ OPERATORID = 1
120
+ OPERATORTYPE = 2
121
+ OPERATORATTRIBUTES = 3
122
+ OPERATORCOUNTERS = 4
123
+ DONE = 5
124
+ STARTED = 6
125
+
126
+ FIELDS = {
127
+ OPERATORID => {:type => ::Thrift::Types::STRING, :name => 'operatorId'},
128
+ OPERATORTYPE => {:type => ::Thrift::Types::I32, :name => 'operatorType', :enum_class => ::Hive::Thrift::OperatorType},
129
+ OPERATORATTRIBUTES => {:type => ::Thrift::Types::MAP, :name => 'operatorAttributes', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}},
130
+ OPERATORCOUNTERS => {:type => ::Thrift::Types::MAP, :name => 'operatorCounters', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::I64}},
131
+ DONE => {:type => ::Thrift::Types::BOOL, :name => 'done'},
132
+ STARTED => {:type => ::Thrift::Types::BOOL, :name => 'started'}
133
+ }
134
+
135
+ def struct_fields; FIELDS; end
136
+
137
+ def validate
138
+ unless @operatorType.nil? || ::Hive::Thrift::OperatorType::VALID_VALUES.include?(@operatorType)
139
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field operatorType!')
140
+ end
141
+ end
142
+
143
+ ::Thrift::Struct.generate_accessors self
134
144
  end
135
- end
136
-
137
- ::Thrift::Struct.generate_accessors self
138
- end
139
145
 
140
- class Task
141
- include ::Thrift::Struct, ::Thrift::Struct_Union
142
- TASKID = 1
143
- TASKTYPE = 2
144
- TASKATTRIBUTES = 3
145
- TASKCOUNTERS = 4
146
- OPERATORGRAPH = 5
147
- OPERATORLIST = 6
148
- DONE = 7
149
- STARTED = 8
150
-
151
- FIELDS = {
152
- TASKID => {:type => ::Thrift::Types::STRING, :name => 'taskId'},
153
- TASKTYPE => {:type => ::Thrift::Types::I32, :name => 'taskType', :enum_class => TaskType},
154
- TASKATTRIBUTES => {:type => ::Thrift::Types::MAP, :name => 'taskAttributes', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}},
155
- TASKCOUNTERS => {:type => ::Thrift::Types::MAP, :name => 'taskCounters', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::I64}},
156
- OPERATORGRAPH => {:type => ::Thrift::Types::STRUCT, :name => 'operatorGraph', :class => Graph, :optional => true},
157
- OPERATORLIST => {:type => ::Thrift::Types::LIST, :name => 'operatorList', :element => {:type => ::Thrift::Types::STRUCT, :class => Operator}, :optional => true},
158
- DONE => {:type => ::Thrift::Types::BOOL, :name => 'done'},
159
- STARTED => {:type => ::Thrift::Types::BOOL, :name => 'started'}
160
- }
161
-
162
- def struct_fields; FIELDS; end
163
-
164
- def validate
165
- unless @taskType.nil? || TaskType::VALID_VALUES.include?(@taskType)
166
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field taskType!')
146
+ class Task
147
+ include ::Thrift::Struct, ::Thrift::Struct_Union
148
+ TASKID = 1
149
+ TASKTYPE = 2
150
+ TASKATTRIBUTES = 3
151
+ TASKCOUNTERS = 4
152
+ OPERATORGRAPH = 5
153
+ OPERATORLIST = 6
154
+ DONE = 7
155
+ STARTED = 8
156
+
157
+ FIELDS = {
158
+ TASKID => {:type => ::Thrift::Types::STRING, :name => 'taskId'},
159
+ TASKTYPE => {:type => ::Thrift::Types::I32, :name => 'taskType', :enum_class => ::Hive::Thrift::TaskType},
160
+ TASKATTRIBUTES => {:type => ::Thrift::Types::MAP, :name => 'taskAttributes', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}},
161
+ TASKCOUNTERS => {:type => ::Thrift::Types::MAP, :name => 'taskCounters', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::I64}},
162
+ OPERATORGRAPH => {:type => ::Thrift::Types::STRUCT, :name => 'operatorGraph', :class => ::Hive::Thrift::Graph, :optional => true},
163
+ OPERATORLIST => {:type => ::Thrift::Types::LIST, :name => 'operatorList', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Hive::Thrift::Operator}, :optional => true},
164
+ DONE => {:type => ::Thrift::Types::BOOL, :name => 'done'},
165
+ STARTED => {:type => ::Thrift::Types::BOOL, :name => 'started'}
166
+ }
167
+
168
+ def struct_fields; FIELDS; end
169
+
170
+ def validate
171
+ unless @taskType.nil? || ::Hive::Thrift::TaskType::VALID_VALUES.include?(@taskType)
172
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field taskType!')
173
+ end
174
+ end
175
+
176
+ ::Thrift::Struct.generate_accessors self
167
177
  end
168
- end
169
-
170
- ::Thrift::Struct.generate_accessors self
171
- end
172
178
 
173
- class Stage
174
- include ::Thrift::Struct, ::Thrift::Struct_Union
175
- STAGEID = 1
176
- STAGETYPE = 2
177
- STAGEATTRIBUTES = 3
178
- STAGECOUNTERS = 4
179
- TASKLIST = 5
180
- DONE = 6
181
- STARTED = 7
182
-
183
- FIELDS = {
184
- STAGEID => {:type => ::Thrift::Types::STRING, :name => 'stageId'},
185
- STAGETYPE => {:type => ::Thrift::Types::I32, :name => 'stageType', :enum_class => StageType},
186
- STAGEATTRIBUTES => {:type => ::Thrift::Types::MAP, :name => 'stageAttributes', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}},
187
- STAGECOUNTERS => {:type => ::Thrift::Types::MAP, :name => 'stageCounters', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::I64}},
188
- TASKLIST => {:type => ::Thrift::Types::LIST, :name => 'taskList', :element => {:type => ::Thrift::Types::STRUCT, :class => Task}},
189
- DONE => {:type => ::Thrift::Types::BOOL, :name => 'done'},
190
- STARTED => {:type => ::Thrift::Types::BOOL, :name => 'started'}
191
- }
192
-
193
- def struct_fields; FIELDS; end
194
-
195
- def validate
196
- unless @stageType.nil? || StageType::VALID_VALUES.include?(@stageType)
197
- raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field stageType!')
179
+ class Stage
180
+ include ::Thrift::Struct, ::Thrift::Struct_Union
181
+ STAGEID = 1
182
+ STAGETYPE = 2
183
+ STAGEATTRIBUTES = 3
184
+ STAGECOUNTERS = 4
185
+ TASKLIST = 5
186
+ DONE = 6
187
+ STARTED = 7
188
+
189
+ FIELDS = {
190
+ STAGEID => {:type => ::Thrift::Types::STRING, :name => 'stageId'},
191
+ STAGETYPE => {:type => ::Thrift::Types::I32, :name => 'stageType', :enum_class => ::Hive::Thrift::StageType},
192
+ STAGEATTRIBUTES => {:type => ::Thrift::Types::MAP, :name => 'stageAttributes', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}},
193
+ STAGECOUNTERS => {:type => ::Thrift::Types::MAP, :name => 'stageCounters', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::I64}},
194
+ TASKLIST => {:type => ::Thrift::Types::LIST, :name => 'taskList', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Hive::Thrift::Task}},
195
+ DONE => {:type => ::Thrift::Types::BOOL, :name => 'done'},
196
+ STARTED => {:type => ::Thrift::Types::BOOL, :name => 'started'}
197
+ }
198
+
199
+ def struct_fields; FIELDS; end
200
+
201
+ def validate
202
+ unless @stageType.nil? || ::Hive::Thrift::StageType::VALID_VALUES.include?(@stageType)
203
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field stageType!')
204
+ end
205
+ end
206
+
207
+ ::Thrift::Struct.generate_accessors self
198
208
  end
199
- end
200
209
 
201
- ::Thrift::Struct.generate_accessors self
202
- end
210
+ class Query
211
+ include ::Thrift::Struct, ::Thrift::Struct_Union
212
+ QUERYID = 1
213
+ QUERYTYPE = 2
214
+ QUERYATTRIBUTES = 3
215
+ QUERYCOUNTERS = 4
216
+ STAGEGRAPH = 5
217
+ STAGELIST = 6
218
+ DONE = 7
219
+ STARTED = 8
220
+
221
+ FIELDS = {
222
+ QUERYID => {:type => ::Thrift::Types::STRING, :name => 'queryId'},
223
+ QUERYTYPE => {:type => ::Thrift::Types::STRING, :name => 'queryType'},
224
+ QUERYATTRIBUTES => {:type => ::Thrift::Types::MAP, :name => 'queryAttributes', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}},
225
+ QUERYCOUNTERS => {:type => ::Thrift::Types::MAP, :name => 'queryCounters', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::I64}},
226
+ STAGEGRAPH => {:type => ::Thrift::Types::STRUCT, :name => 'stageGraph', :class => ::Hive::Thrift::Graph},
227
+ STAGELIST => {:type => ::Thrift::Types::LIST, :name => 'stageList', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Hive::Thrift::Stage}},
228
+ DONE => {:type => ::Thrift::Types::BOOL, :name => 'done'},
229
+ STARTED => {:type => ::Thrift::Types::BOOL, :name => 'started'}
230
+ }
231
+
232
+ def struct_fields; FIELDS; end
233
+
234
+ def validate
235
+ end
236
+
237
+ ::Thrift::Struct.generate_accessors self
238
+ end
203
239
 
204
- class Query
205
- include ::Thrift::Struct, ::Thrift::Struct_Union
206
- QUERYID = 1
207
- QUERYTYPE = 2
208
- QUERYATTRIBUTES = 3
209
- QUERYCOUNTERS = 4
210
- STAGEGRAPH = 5
211
- STAGELIST = 6
212
- DONE = 7
213
- STARTED = 8
214
-
215
- FIELDS = {
216
- QUERYID => {:type => ::Thrift::Types::STRING, :name => 'queryId'},
217
- QUERYTYPE => {:type => ::Thrift::Types::STRING, :name => 'queryType'},
218
- QUERYATTRIBUTES => {:type => ::Thrift::Types::MAP, :name => 'queryAttributes', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}},
219
- QUERYCOUNTERS => {:type => ::Thrift::Types::MAP, :name => 'queryCounters', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::I64}},
220
- STAGEGRAPH => {:type => ::Thrift::Types::STRUCT, :name => 'stageGraph', :class => Graph},
221
- STAGELIST => {:type => ::Thrift::Types::LIST, :name => 'stageList', :element => {:type => ::Thrift::Types::STRUCT, :class => Stage}},
222
- DONE => {:type => ::Thrift::Types::BOOL, :name => 'done'},
223
- STARTED => {:type => ::Thrift::Types::BOOL, :name => 'started'}
224
- }
225
-
226
- def struct_fields; FIELDS; end
227
-
228
- def validate
229
- end
240
+ class QueryPlan
241
+ include ::Thrift::Struct, ::Thrift::Struct_Union
242
+ QUERIES = 1
243
+ DONE = 2
244
+ STARTED = 3
230
245
 
231
- ::Thrift::Struct.generate_accessors self
232
- end
246
+ FIELDS = {
247
+ QUERIES => {:type => ::Thrift::Types::LIST, :name => 'queries', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Hive::Thrift::Query}},
248
+ DONE => {:type => ::Thrift::Types::BOOL, :name => 'done'},
249
+ STARTED => {:type => ::Thrift::Types::BOOL, :name => 'started'}
250
+ }
233
251
 
234
- class QueryPlan
235
- include ::Thrift::Struct, ::Thrift::Struct_Union
236
- QUERIES = 1
237
- DONE = 2
238
- STARTED = 3
252
+ def struct_fields; FIELDS; end
239
253
 
240
- FIELDS = {
241
- QUERIES => {:type => ::Thrift::Types::LIST, :name => 'queries', :element => {:type => ::Thrift::Types::STRUCT, :class => Query}},
242
- DONE => {:type => ::Thrift::Types::BOOL, :name => 'done'},
243
- STARTED => {:type => ::Thrift::Types::BOOL, :name => 'started'}
244
- }
254
+ def validate
255
+ end
245
256
 
246
- def struct_fields; FIELDS; end
257
+ ::Thrift::Struct.generate_accessors self
258
+ end
247
259
 
248
- def validate
249
260
  end
250
-
251
- ::Thrift::Struct.generate_accessors self
252
261
  end
253
-
@@ -0,0 +1,97 @@
1
+ module Thrift
2
+ class SaslClientTransport < BufferedTransport
3
+ attr_reader :challenge
4
+
5
+ STATUS_BYTES = 1
6
+ PAYLOAD_LENGTH_BYTES = 4
7
+ AUTH_MECHANISM = 'PLAIN'
8
+ NEGOTIATION_STATUS = {
9
+ START: 0x01,
10
+ OK: 0x02,
11
+ BAD: 0x03,
12
+ ERROR: 0x04,
13
+ COMPLETE: 0x05
14
+ }
15
+
16
+ def initialize(transport, sasl_params={})
17
+ super(transport)
18
+ @challenge = nil
19
+ @sasl_username = sasl_params.fetch(:username, 'anonymous')
20
+ @sasl_password = sasl_params.fetch(:password, 'anonymous')
21
+ end
22
+
23
+ def read(sz)
24
+ len, = @transport.read(PAYLOAD_LENGTH_BYTES).unpack('l>') if @rbuf.nil?
25
+ sz = len if len && sz > len
26
+ @index += sz
27
+ ret = @rbuf.slice(@index - sz, sz) || Bytes.empty_byte_buffer
28
+ if ret.length == 0
29
+ @rbuf = @transport.read(len) rescue Bytes.empty_byte_buffer
30
+ @index = sz
31
+ ret = @rbuf.slice(0, sz) || Bytes.empty_byte_buffer
32
+ end
33
+ ret
34
+ end
35
+
36
+ def read_byte
37
+ reset_buffer! if @index >= @rbuf.size
38
+ @index += 1
39
+ Bytes.get_string_byte(@rbuf, @index - 1)
40
+ end
41
+
42
+ def read_into_buffer(buffer, size)
43
+ i = 0
44
+ while i < size
45
+ reset_buffer! if @index >= @rbuf.size
46
+ byte = Bytes.get_string_byte(@rbuf, @index)
47
+ Bytes.set_string_byte(buffer, i, byte)
48
+ @index += 1
49
+ i += 1
50
+ end
51
+ i
52
+ end
53
+
54
+ def write(buf)
55
+ initiate_hand_shake if @challenge.nil?
56
+ header = [buf.length].pack('l>')
57
+ @wbuf << (header + Bytes.force_binary_encoding(buf))
58
+ end
59
+
60
+ protected
61
+
62
+ def initiate_hand_shake
63
+ header = [NEGOTIATION_STATUS[:START], AUTH_MECHANISM.length].pack('cl>')
64
+ @transport.write header + AUTH_MECHANISM
65
+ message = "[#{AUTH_MECHANISM}]\u0000#{@sasl_username}\u0000#{@sasl_password}"
66
+ header = [NEGOTIATION_STATUS[:OK], message.length].pack('cl>')
67
+ @transport.write header + message
68
+ status, len = @transport.read(STATUS_BYTES + PAYLOAD_LENGTH_BYTES).unpack('cl>')
69
+ case status
70
+ when NEGOTIATION_STATUS[:BAD], NEGOTIATION_STATUS[:ERROR]
71
+ raise @transport.to_io.read(len)
72
+ when NEGOTIATION_STATUS[:COMPLETE]
73
+ @challenge = @transport.to_io.read len
74
+ when NEGOTIATION_STATUS[:OK]
75
+ raise "Failed to complete challenge exchange: only NONE supported currently"
76
+ end
77
+ end
78
+
79
+ private
80
+
81
+ def reset_buffer!
82
+ len, = @transport.read(PAYLOAD_LENGTH_BYTES).unpack('l>')
83
+ @rbuf = @transport.read(len)
84
+ while @rbuf.size < len
85
+ @rbuf << @transport.read(len - @rbuf.size)
86
+ end
87
+ @index = 0
88
+ end
89
+ end
90
+
91
+ class SaslClientTransportFactory < BaseTransportFactory
92
+ def get_transport(transport)
93
+ return SaslClientTransport.new(transport)
94
+ end
95
+ end
96
+
97
+ end
@@ -1,10 +1,11 @@
1
1
  #
2
- # Autogenerated by Thrift
2
+ # Autogenerated by Thrift Compiler (0.9.0)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
6
6
 
7
- require File.join(File.dirname(__FILE__), *%w[serde_types])
7
+ require 'thrift'
8
+ require 'serde_types'
8
9
 
9
10
  SERIALIZATION_LIB = %q"serialization.lib"
10
11
 
@@ -64,6 +65,8 @@ MAP_TYPE_NAME = %q"map"
64
65
 
65
66
  STRUCT_TYPE_NAME = %q"struct"
66
67
 
68
+ UNION_TYPE_NAME = %q"uniontype"
69
+
67
70
  LIST_COLUMNS = %q"columns"
68
71
 
69
72
  LIST_COLUMN_TYPES = %q"columns.types"
@@ -87,4 +90,3 @@ CollectionTypes = Set.new([
87
90
  %q"array",
88
91
  %q"map",
89
92
  ])
90
-
@@ -1,7 +1,7 @@
1
1
  #
2
- # Autogenerated by Thrift
2
+ # Autogenerated by Thrift Compiler (0.9.0)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
6
6
 
7
-
7
+ require 'thrift'