rbhive 0.1.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.
- data/lib/rbhive/connection.rb +77 -0
- data/lib/rbhive.rb +1 -0
- data/lib/thrift/facebook_service.rb +688 -0
- data/lib/thrift/fb303_constants.rb +8 -0
- data/lib/thrift/fb303_types.rb +18 -0
- data/lib/thrift/hive_metastore_constants.rb +32 -0
- data/lib/thrift/hive_metastore_types.rb +430 -0
- data/lib/thrift/hive_service_constants.rb +8 -0
- data/lib/thrift/hive_service_types.rb +67 -0
- data/lib/thrift/reflection_limited_constants.rb +8 -0
- data/lib/thrift/reflection_limited_types.rb +150 -0
- data/lib/thrift/serde_constants.rb +88 -0
- data/lib/thrift/serde_types.rb +7 -0
- data/lib/thrift/thrift_hive.rb +439 -0
- data/lib/thrift/thrift_hive_metastore.rb +1502 -0
- metadata +88 -0
@@ -0,0 +1,88 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require File.join(File.dirname(__FILE__), *%w[serde_types])
|
8
|
+
|
9
|
+
SERIALIZATION_LIB = %q"serialization.lib"
|
10
|
+
|
11
|
+
SERIALIZATION_CLASS = %q"serialization.class"
|
12
|
+
|
13
|
+
SERIALIZATION_FORMAT = %q"serialization.format"
|
14
|
+
|
15
|
+
SERIALIZATION_DDL = %q"serialization.ddl"
|
16
|
+
|
17
|
+
SERIALIZATION_NULL_FORMAT = %q"serialization.null.format"
|
18
|
+
|
19
|
+
SERIALIZATION_LAST_COLUMN_TAKES_REST = %q"serialization.last.column.takes.rest"
|
20
|
+
|
21
|
+
SERIALIZATION_SORT_ORDER = %q"serialization.sort.order"
|
22
|
+
|
23
|
+
FIELD_DELIM = %q"field.delim"
|
24
|
+
|
25
|
+
COLLECTION_DELIM = %q"colelction.delim"
|
26
|
+
|
27
|
+
LINE_DELIM = %q"line.delim"
|
28
|
+
|
29
|
+
MAPKEY_DELIM = %q"mapkey.delim"
|
30
|
+
|
31
|
+
QUOTE_CHAR = %q"quote.delim"
|
32
|
+
|
33
|
+
ESCAPE_CHAR = %q"escape.delim"
|
34
|
+
|
35
|
+
VOID_TYPE_NAME = %q"void"
|
36
|
+
|
37
|
+
BOOLEAN_TYPE_NAME = %q"boolean"
|
38
|
+
|
39
|
+
TINYINT_TYPE_NAME = %q"tinyint"
|
40
|
+
|
41
|
+
SMALLINT_TYPE_NAME = %q"smallint"
|
42
|
+
|
43
|
+
INT_TYPE_NAME = %q"int"
|
44
|
+
|
45
|
+
BIGINT_TYPE_NAME = %q"bigint"
|
46
|
+
|
47
|
+
FLOAT_TYPE_NAME = %q"float"
|
48
|
+
|
49
|
+
DOUBLE_TYPE_NAME = %q"double"
|
50
|
+
|
51
|
+
STRING_TYPE_NAME = %q"string"
|
52
|
+
|
53
|
+
DATE_TYPE_NAME = %q"date"
|
54
|
+
|
55
|
+
DATETIME_TYPE_NAME = %q"datetime"
|
56
|
+
|
57
|
+
TIMESTAMP_TYPE_NAME = %q"timestamp"
|
58
|
+
|
59
|
+
LIST_TYPE_NAME = %q"array"
|
60
|
+
|
61
|
+
MAP_TYPE_NAME = %q"map"
|
62
|
+
|
63
|
+
STRUCT_TYPE_NAME = %q"struct"
|
64
|
+
|
65
|
+
LIST_COLUMNS = %q"columns"
|
66
|
+
|
67
|
+
LIST_COLUMN_TYPES = %q"columns.types"
|
68
|
+
|
69
|
+
PrimitiveTypes = Set.new([
|
70
|
+
%q"void",
|
71
|
+
%q"boolean",
|
72
|
+
%q"tinyint",
|
73
|
+
%q"smallint",
|
74
|
+
%q"int",
|
75
|
+
%q"bigint",
|
76
|
+
%q"float",
|
77
|
+
%q"double",
|
78
|
+
%q"string",
|
79
|
+
%q"date",
|
80
|
+
%q"datetime",
|
81
|
+
%q"timestamp",
|
82
|
+
])
|
83
|
+
|
84
|
+
CollectionTypes = Set.new([
|
85
|
+
%q"array",
|
86
|
+
%q"map",
|
87
|
+
])
|
88
|
+
|
@@ -0,0 +1,439 @@
|
|
1
|
+
#
|
2
|
+
# Autogenerated by Thrift
|
3
|
+
#
|
4
|
+
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
5
|
+
#
|
6
|
+
|
7
|
+
require 'thrift'
|
8
|
+
require File.join(File.dirname(__FILE__), *%w[thrift_hive_metastore])
|
9
|
+
require File.join(File.dirname(__FILE__), *%w[hive_service_types])
|
10
|
+
|
11
|
+
module ThriftHive
|
12
|
+
class Client < ThriftHiveMetastore::Client
|
13
|
+
include ::Thrift::Client
|
14
|
+
|
15
|
+
def execute(query)
|
16
|
+
send_execute(query)
|
17
|
+
recv_execute()
|
18
|
+
end
|
19
|
+
|
20
|
+
def send_execute(query)
|
21
|
+
send_message('execute', Execute_args, :query => query)
|
22
|
+
end
|
23
|
+
|
24
|
+
def recv_execute()
|
25
|
+
result = receive_message(Execute_result)
|
26
|
+
raise result.ex unless result.ex.nil?
|
27
|
+
return
|
28
|
+
end
|
29
|
+
|
30
|
+
def fetchOne()
|
31
|
+
send_fetchOne()
|
32
|
+
return recv_fetchOne()
|
33
|
+
end
|
34
|
+
|
35
|
+
def send_fetchOne()
|
36
|
+
send_message('fetchOne', FetchOne_args)
|
37
|
+
end
|
38
|
+
|
39
|
+
def recv_fetchOne()
|
40
|
+
result = receive_message(FetchOne_result)
|
41
|
+
return result.success unless result.success.nil?
|
42
|
+
raise result.ex unless result.ex.nil?
|
43
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'fetchOne failed: unknown result')
|
44
|
+
end
|
45
|
+
|
46
|
+
def fetchN(numRows)
|
47
|
+
send_fetchN(numRows)
|
48
|
+
return recv_fetchN()
|
49
|
+
end
|
50
|
+
|
51
|
+
def send_fetchN(numRows)
|
52
|
+
send_message('fetchN', FetchN_args, :numRows => numRows)
|
53
|
+
end
|
54
|
+
|
55
|
+
def recv_fetchN()
|
56
|
+
result = receive_message(FetchN_result)
|
57
|
+
return result.success unless result.success.nil?
|
58
|
+
raise result.ex unless result.ex.nil?
|
59
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'fetchN failed: unknown result')
|
60
|
+
end
|
61
|
+
|
62
|
+
def fetchAll()
|
63
|
+
send_fetchAll()
|
64
|
+
return recv_fetchAll()
|
65
|
+
end
|
66
|
+
|
67
|
+
def send_fetchAll()
|
68
|
+
send_message('fetchAll', FetchAll_args)
|
69
|
+
end
|
70
|
+
|
71
|
+
def recv_fetchAll()
|
72
|
+
result = receive_message(FetchAll_result)
|
73
|
+
return result.success unless result.success.nil?
|
74
|
+
raise result.ex unless result.ex.nil?
|
75
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'fetchAll failed: unknown result')
|
76
|
+
end
|
77
|
+
|
78
|
+
def getSchema()
|
79
|
+
send_getSchema()
|
80
|
+
return recv_getSchema()
|
81
|
+
end
|
82
|
+
|
83
|
+
def send_getSchema()
|
84
|
+
send_message('getSchema', GetSchema_args)
|
85
|
+
end
|
86
|
+
|
87
|
+
def recv_getSchema()
|
88
|
+
result = receive_message(GetSchema_result)
|
89
|
+
return result.success unless result.success.nil?
|
90
|
+
raise result.ex unless result.ex.nil?
|
91
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getSchema failed: unknown result')
|
92
|
+
end
|
93
|
+
|
94
|
+
def getThriftSchema()
|
95
|
+
send_getThriftSchema()
|
96
|
+
return recv_getThriftSchema()
|
97
|
+
end
|
98
|
+
|
99
|
+
def send_getThriftSchema()
|
100
|
+
send_message('getThriftSchema', GetThriftSchema_args)
|
101
|
+
end
|
102
|
+
|
103
|
+
def recv_getThriftSchema()
|
104
|
+
result = receive_message(GetThriftSchema_result)
|
105
|
+
return result.success unless result.success.nil?
|
106
|
+
raise result.ex unless result.ex.nil?
|
107
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getThriftSchema failed: unknown result')
|
108
|
+
end
|
109
|
+
|
110
|
+
def getClusterStatus()
|
111
|
+
send_getClusterStatus()
|
112
|
+
return recv_getClusterStatus()
|
113
|
+
end
|
114
|
+
|
115
|
+
def send_getClusterStatus()
|
116
|
+
send_message('getClusterStatus', GetClusterStatus_args)
|
117
|
+
end
|
118
|
+
|
119
|
+
def recv_getClusterStatus()
|
120
|
+
result = receive_message(GetClusterStatus_result)
|
121
|
+
return result.success unless result.success.nil?
|
122
|
+
raise result.ex unless result.ex.nil?
|
123
|
+
raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'getClusterStatus failed: unknown result')
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
class Processor < ThriftHiveMetastore::Processor
|
129
|
+
include ::Thrift::Processor
|
130
|
+
|
131
|
+
def process_execute(seqid, iprot, oprot)
|
132
|
+
args = read_args(iprot, Execute_args)
|
133
|
+
result = Execute_result.new()
|
134
|
+
begin
|
135
|
+
@handler.execute(args.query)
|
136
|
+
rescue HiveServerException => ex
|
137
|
+
result.ex = ex
|
138
|
+
end
|
139
|
+
write_result(result, oprot, 'execute', seqid)
|
140
|
+
end
|
141
|
+
|
142
|
+
def process_fetchOne(seqid, iprot, oprot)
|
143
|
+
args = read_args(iprot, FetchOne_args)
|
144
|
+
result = FetchOne_result.new()
|
145
|
+
begin
|
146
|
+
result.success = @handler.fetchOne()
|
147
|
+
rescue HiveServerException => ex
|
148
|
+
result.ex = ex
|
149
|
+
end
|
150
|
+
write_result(result, oprot, 'fetchOne', seqid)
|
151
|
+
end
|
152
|
+
|
153
|
+
def process_fetchN(seqid, iprot, oprot)
|
154
|
+
args = read_args(iprot, FetchN_args)
|
155
|
+
result = FetchN_result.new()
|
156
|
+
begin
|
157
|
+
result.success = @handler.fetchN(args.numRows)
|
158
|
+
rescue HiveServerException => ex
|
159
|
+
result.ex = ex
|
160
|
+
end
|
161
|
+
write_result(result, oprot, 'fetchN', seqid)
|
162
|
+
end
|
163
|
+
|
164
|
+
def process_fetchAll(seqid, iprot, oprot)
|
165
|
+
args = read_args(iprot, FetchAll_args)
|
166
|
+
result = FetchAll_result.new()
|
167
|
+
begin
|
168
|
+
result.success = @handler.fetchAll()
|
169
|
+
rescue HiveServerException => ex
|
170
|
+
result.ex = ex
|
171
|
+
end
|
172
|
+
write_result(result, oprot, 'fetchAll', seqid)
|
173
|
+
end
|
174
|
+
|
175
|
+
def process_getSchema(seqid, iprot, oprot)
|
176
|
+
args = read_args(iprot, GetSchema_args)
|
177
|
+
result = GetSchema_result.new()
|
178
|
+
begin
|
179
|
+
result.success = @handler.getSchema()
|
180
|
+
rescue HiveServerException => ex
|
181
|
+
result.ex = ex
|
182
|
+
end
|
183
|
+
write_result(result, oprot, 'getSchema', seqid)
|
184
|
+
end
|
185
|
+
|
186
|
+
def process_getThriftSchema(seqid, iprot, oprot)
|
187
|
+
args = read_args(iprot, GetThriftSchema_args)
|
188
|
+
result = GetThriftSchema_result.new()
|
189
|
+
begin
|
190
|
+
result.success = @handler.getThriftSchema()
|
191
|
+
rescue HiveServerException => ex
|
192
|
+
result.ex = ex
|
193
|
+
end
|
194
|
+
write_result(result, oprot, 'getThriftSchema', seqid)
|
195
|
+
end
|
196
|
+
|
197
|
+
def process_getClusterStatus(seqid, iprot, oprot)
|
198
|
+
args = read_args(iprot, GetClusterStatus_args)
|
199
|
+
result = GetClusterStatus_result.new()
|
200
|
+
begin
|
201
|
+
result.success = @handler.getClusterStatus()
|
202
|
+
rescue HiveServerException => ex
|
203
|
+
result.ex = ex
|
204
|
+
end
|
205
|
+
write_result(result, oprot, 'getClusterStatus', seqid)
|
206
|
+
end
|
207
|
+
|
208
|
+
end
|
209
|
+
|
210
|
+
# HELPER FUNCTIONS AND STRUCTURES
|
211
|
+
|
212
|
+
class Execute_args
|
213
|
+
include ::Thrift::Struct
|
214
|
+
QUERY = 1
|
215
|
+
|
216
|
+
::Thrift::Struct.field_accessor self, :query
|
217
|
+
FIELDS = {
|
218
|
+
QUERY => {:type => ::Thrift::Types::STRING, :name => 'query'}
|
219
|
+
}
|
220
|
+
|
221
|
+
def struct_fields; FIELDS; end
|
222
|
+
|
223
|
+
def validate
|
224
|
+
end
|
225
|
+
|
226
|
+
end
|
227
|
+
|
228
|
+
class Execute_result
|
229
|
+
include ::Thrift::Struct
|
230
|
+
EX = 1
|
231
|
+
|
232
|
+
::Thrift::Struct.field_accessor self, :ex
|
233
|
+
FIELDS = {
|
234
|
+
EX => {:type => ::Thrift::Types::STRUCT, :name => 'ex', :class => HiveServerException}
|
235
|
+
}
|
236
|
+
|
237
|
+
def struct_fields; FIELDS; end
|
238
|
+
|
239
|
+
def validate
|
240
|
+
end
|
241
|
+
|
242
|
+
end
|
243
|
+
|
244
|
+
class FetchOne_args
|
245
|
+
include ::Thrift::Struct
|
246
|
+
|
247
|
+
FIELDS = {
|
248
|
+
|
249
|
+
}
|
250
|
+
|
251
|
+
def struct_fields; FIELDS; end
|
252
|
+
|
253
|
+
def validate
|
254
|
+
end
|
255
|
+
|
256
|
+
end
|
257
|
+
|
258
|
+
class FetchOne_result
|
259
|
+
include ::Thrift::Struct
|
260
|
+
SUCCESS = 0
|
261
|
+
EX = 1
|
262
|
+
|
263
|
+
::Thrift::Struct.field_accessor self, :success, :ex
|
264
|
+
FIELDS = {
|
265
|
+
SUCCESS => {:type => ::Thrift::Types::STRING, :name => 'success'},
|
266
|
+
EX => {:type => ::Thrift::Types::STRUCT, :name => 'ex', :class => HiveServerException}
|
267
|
+
}
|
268
|
+
|
269
|
+
def struct_fields; FIELDS; end
|
270
|
+
|
271
|
+
def validate
|
272
|
+
end
|
273
|
+
|
274
|
+
end
|
275
|
+
|
276
|
+
class FetchN_args
|
277
|
+
include ::Thrift::Struct
|
278
|
+
NUMROWS = 1
|
279
|
+
|
280
|
+
::Thrift::Struct.field_accessor self, :numRows
|
281
|
+
FIELDS = {
|
282
|
+
NUMROWS => {:type => ::Thrift::Types::I32, :name => 'numRows'}
|
283
|
+
}
|
284
|
+
|
285
|
+
def struct_fields; FIELDS; end
|
286
|
+
|
287
|
+
def validate
|
288
|
+
end
|
289
|
+
|
290
|
+
end
|
291
|
+
|
292
|
+
class FetchN_result
|
293
|
+
include ::Thrift::Struct
|
294
|
+
SUCCESS = 0
|
295
|
+
EX = 1
|
296
|
+
|
297
|
+
::Thrift::Struct.field_accessor self, :success, :ex
|
298
|
+
FIELDS = {
|
299
|
+
SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRING}},
|
300
|
+
EX => {:type => ::Thrift::Types::STRUCT, :name => 'ex', :class => HiveServerException}
|
301
|
+
}
|
302
|
+
|
303
|
+
def struct_fields; FIELDS; end
|
304
|
+
|
305
|
+
def validate
|
306
|
+
end
|
307
|
+
|
308
|
+
end
|
309
|
+
|
310
|
+
class FetchAll_args
|
311
|
+
include ::Thrift::Struct
|
312
|
+
|
313
|
+
FIELDS = {
|
314
|
+
|
315
|
+
}
|
316
|
+
|
317
|
+
def struct_fields; FIELDS; end
|
318
|
+
|
319
|
+
def validate
|
320
|
+
end
|
321
|
+
|
322
|
+
end
|
323
|
+
|
324
|
+
class FetchAll_result
|
325
|
+
include ::Thrift::Struct
|
326
|
+
SUCCESS = 0
|
327
|
+
EX = 1
|
328
|
+
|
329
|
+
::Thrift::Struct.field_accessor self, :success, :ex
|
330
|
+
FIELDS = {
|
331
|
+
SUCCESS => {:type => ::Thrift::Types::LIST, :name => 'success', :element => {:type => ::Thrift::Types::STRING}},
|
332
|
+
EX => {:type => ::Thrift::Types::STRUCT, :name => 'ex', :class => HiveServerException}
|
333
|
+
}
|
334
|
+
|
335
|
+
def struct_fields; FIELDS; end
|
336
|
+
|
337
|
+
def validate
|
338
|
+
end
|
339
|
+
|
340
|
+
end
|
341
|
+
|
342
|
+
class GetSchema_args
|
343
|
+
include ::Thrift::Struct
|
344
|
+
|
345
|
+
FIELDS = {
|
346
|
+
|
347
|
+
}
|
348
|
+
|
349
|
+
def struct_fields; FIELDS; end
|
350
|
+
|
351
|
+
def validate
|
352
|
+
end
|
353
|
+
|
354
|
+
end
|
355
|
+
|
356
|
+
class GetSchema_result
|
357
|
+
include ::Thrift::Struct
|
358
|
+
SUCCESS = 0
|
359
|
+
EX = 1
|
360
|
+
|
361
|
+
::Thrift::Struct.field_accessor self, :success, :ex
|
362
|
+
FIELDS = {
|
363
|
+
SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Schema},
|
364
|
+
EX => {:type => ::Thrift::Types::STRUCT, :name => 'ex', :class => HiveServerException}
|
365
|
+
}
|
366
|
+
|
367
|
+
def struct_fields; FIELDS; end
|
368
|
+
|
369
|
+
def validate
|
370
|
+
end
|
371
|
+
|
372
|
+
end
|
373
|
+
|
374
|
+
class GetThriftSchema_args
|
375
|
+
include ::Thrift::Struct
|
376
|
+
|
377
|
+
FIELDS = {
|
378
|
+
|
379
|
+
}
|
380
|
+
|
381
|
+
def struct_fields; FIELDS; end
|
382
|
+
|
383
|
+
def validate
|
384
|
+
end
|
385
|
+
|
386
|
+
end
|
387
|
+
|
388
|
+
class GetThriftSchema_result
|
389
|
+
include ::Thrift::Struct
|
390
|
+
SUCCESS = 0
|
391
|
+
EX = 1
|
392
|
+
|
393
|
+
::Thrift::Struct.field_accessor self, :success, :ex
|
394
|
+
FIELDS = {
|
395
|
+
SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => Schema},
|
396
|
+
EX => {:type => ::Thrift::Types::STRUCT, :name => 'ex', :class => HiveServerException}
|
397
|
+
}
|
398
|
+
|
399
|
+
def struct_fields; FIELDS; end
|
400
|
+
|
401
|
+
def validate
|
402
|
+
end
|
403
|
+
|
404
|
+
end
|
405
|
+
|
406
|
+
class GetClusterStatus_args
|
407
|
+
include ::Thrift::Struct
|
408
|
+
|
409
|
+
FIELDS = {
|
410
|
+
|
411
|
+
}
|
412
|
+
|
413
|
+
def struct_fields; FIELDS; end
|
414
|
+
|
415
|
+
def validate
|
416
|
+
end
|
417
|
+
|
418
|
+
end
|
419
|
+
|
420
|
+
class GetClusterStatus_result
|
421
|
+
include ::Thrift::Struct
|
422
|
+
SUCCESS = 0
|
423
|
+
EX = 1
|
424
|
+
|
425
|
+
::Thrift::Struct.field_accessor self, :success, :ex
|
426
|
+
FIELDS = {
|
427
|
+
SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => HiveClusterStatus},
|
428
|
+
EX => {:type => ::Thrift::Types::STRUCT, :name => 'ex', :class => HiveServerException}
|
429
|
+
}
|
430
|
+
|
431
|
+
def struct_fields; FIELDS; end
|
432
|
+
|
433
|
+
def validate
|
434
|
+
end
|
435
|
+
|
436
|
+
end
|
437
|
+
|
438
|
+
end
|
439
|
+
|