rbhive 0.5.3 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,2 +1,18 @@
1
+ .DS_Store
1
2
  *.gem
2
- .DS_Store
3
+ *.rbc
4
+ .bundle
5
+ .config
6
+ .yardoc
7
+ Gemfile.lock
8
+ InstalledFiles
9
+ _yardoc
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
data/CHANGELOG.md ADDED
@@ -0,0 +1,16 @@
1
+ # RBHive changelog
2
+
3
+ Versioning prior to 0.5.3 was not tracked, so this changelog only lists changes introduced after 0.5.3.
4
+
5
+ ## 0.6.0
6
+
7
+ 0.6.0 introduces one backwards-incompatible change:
8
+
9
+ * Behaviour change: RBHive will no longer coerce the strings "NULL" or "null" to the Ruby `nil`; the rationale
10
+ for this change is that it introduces hard to trace bugs and does not seem to make sense from a logical
11
+ perspective (Hive's "NULL" is a very different thing to Ruby's `nil`).
12
+
13
+ 0.6.0 introduces support for Hive 0.13, and for the Hive 0.11 version shipped with CDH5 Beta 1 and Beta 2:
14
+
15
+ * Thrift protocol bindings updated to include all the protocols shipped with the Hive 0.13 release.
16
+ * Allow the user to choose a protocol explicitly; provided helper symbols / lookups for common protocols (e.g. CDH4, CDH5)
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/README.md CHANGED
@@ -73,7 +73,8 @@ Since Hiveserver has no options, connection code is very simple:
73
73
  Hiveserver2 has several options with how it is run. The connection code takes
74
74
  a hash with these possible parameters:
75
75
  * `:transport` - one of `:buffered` (BufferedTransport), `:http` (HTTPClientTransport), or `:sasl` (SaslClientTransport)
76
- * `:hive_version` - the number after the period in the Hive version; e.g. `10`, `11`, `12`
76
+ * `:hive_version` - the number after the period in the Hive version; e.g. `10`, `11`, `12`, `13` or one of
77
+ a set of symbols; see [Hiveserver2 protocol versions](#hiveserver2-protocol-versions) below for details
77
78
  * `:timeout` - if using BufferedTransport or SaslClientTransport, this is how long the timeout on the socket will be
78
79
  * `:sasl_params` - if using SaslClientTransport, this is a hash of parameters to set up the SASL connection
79
80
 
@@ -100,6 +101,34 @@ Connecting with a specific Hive version (0.12) and using the `:http` transport:
100
101
 
101
102
  We have not tested the SASL connection, as we don't run SASL; pull requests and testing are welcomed.
102
103
 
104
+ #### Hiveserver2 protocol versions
105
+
106
+ Since the introduction of Hiveserver2 in Hive 0.10, there have been a number of revisions to the Thrift protocol it uses.
107
+
108
+ The following table lists the available values you can supply to the `:hive_version` parameter when making a connection
109
+ to Hiveserver2.
110
+
111
+ | value | Thrift protocol version | notes
112
+ | ------- | ----------------------- | -----
113
+ | `10` | V1 | First version of the Thrift protocol used only by Hive 0.10
114
+ | `11` | V2 | Used by the Hive 0.11 release (*but not CDH5 which ships with Hive 0.11!*) - adds asynchronous execution
115
+ | `12` | V3 | Used by the Hive 0.12 release, adds varchar type and primitive type qualifiers
116
+ | `13` | V7 | Used by the Hive 0.13 release, adds features from V4, V5 and V6, plus token-based delegation connections
117
+ | `:cdh4` | V1 | CDH4 uses the V1 protocol as it ships with the upstream Hive 0.10
118
+ | `:cdh5` | V5 | CDH5 ships with upstream Hive 0.11, but adds patches to bring the Thrift protocol up to V5
119
+
120
+ In addition, you can explicitly set the Thrift protocol version according to this table:
121
+
122
+ | value | Thrift protocol version | notes
123
+ | --------------- | ----------------------- | -----
124
+ | `:PROTOCOL_V1` | V1 | Used by Hive 0.10 release
125
+ | `:PROTOCOL_V2` | V2 | Used by Hive 0.11 release
126
+ | `:PROTOCOL_V3` | V3 | Used by Hive 0.12 release
127
+ | `:PROTOCOL_V4` | V4 | Updated during Hive 0.13 development, adds decimal precision/scale, char type
128
+ | `:PROTOCOL_V5` | V5 | Updated during Hive 0.13 development, adds error details when GetOperationStatus returns in error state
129
+ | `:PROTOCOL_V6` | V6 | Updated during Hive 0.13 development, adds binary type for binary payload, uses columnar result set
130
+ | `:PROTOCOL_V7` | V7 | Used by Hive 0.13 release, support for token-based delegation connections
131
+
103
132
  ## Examples
104
133
 
105
134
  ### Fetching results
@@ -217,6 +246,9 @@ on whether it works correctly.
217
246
 
218
247
  ## Contributing
219
248
 
249
+ We welcome contributions, issues and pull requests. If there's a feature missing in RBHive that you need, or you
250
+ think you've found a bug, please do not hesitate to create an issue.
251
+
220
252
  1. Fork it
221
253
  2. Create your feature branch (`git checkout -b my-new-feature`)
222
254
  3. Commit your changes (`git commit -am 'Add some feature'`)
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -65,7 +65,6 @@ module RBHive
65
65
  type = column_type_map[column_name]
66
66
  return 1.0/0.0 if(type != :string && value == "Infinity")
67
67
  return 0.0/0.0 if(type != :string && value == "NaN")
68
- return nil if value.nil? || value == 'NULL' || value == 'null'
69
68
  return coerce_complex_value(value) if type.to_s =~ /^array/
70
69
  conversion_method = TYPES[type]
71
70
  conversion_method ? value.send(conversion_method) : value
@@ -34,7 +34,17 @@ module RBHive
34
34
  HIVE_THRIFT_MAPPING = {
35
35
  10 => 0,
36
36
  11 => 1,
37
- 12 => 2
37
+ 12 => 2,
38
+ 13 => 6,
39
+ :cdh4 => 0,
40
+ :cdh5 => 4,
41
+ :PROTOCOL_V1 => 0,
42
+ :PROTOCOL_V2 => 1,
43
+ :PROTOCOL_V3 => 2,
44
+ :PROTOCOL_V4 => 3,
45
+ :PROTOCOL_V5 => 4,
46
+ :PROTOCOL_V6 => 5,
47
+ :PROTOCOL_V7 => 6
38
48
  }
39
49
 
40
50
  def tcli_connect(server, port=10_000, options)
@@ -67,7 +67,6 @@ module RBHive
67
67
  type = column_type_map[column_name]
68
68
  return 1.0/0.0 if(type != :string && value == "Infinity")
69
69
  return 0.0/0.0 if(type != :string && value == "NaN")
70
- return nil if value.nil? || value == 'NULL' || value == 'null'
71
70
  return coerce_complex_value(value) if type.to_s =~ /^array/
72
71
  conversion_method = TYPES[type]
73
72
  conversion_method ? value.send(conversion_method) : value
@@ -1,3 +1,3 @@
1
1
  module RBHive
2
- VERSION = '0.5.3'
2
+ VERSION = '0.6.0'
3
3
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (0.9.0)
2
+ # Autogenerated by Thrift Compiler (0.9.1)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -253,6 +253,51 @@ module Hive2
253
253
  raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'FetchResults failed: unknown result')
254
254
  end
255
255
 
256
+ def GetDelegationToken(req)
257
+ send_GetDelegationToken(req)
258
+ return recv_GetDelegationToken()
259
+ end
260
+
261
+ def send_GetDelegationToken(req)
262
+ send_message('GetDelegationToken', GetDelegationToken_args, :req => req)
263
+ end
264
+
265
+ def recv_GetDelegationToken()
266
+ result = receive_message(GetDelegationToken_result)
267
+ return result.success unless result.success.nil?
268
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'GetDelegationToken failed: unknown result')
269
+ end
270
+
271
+ def CancelDelegationToken(req)
272
+ send_CancelDelegationToken(req)
273
+ return recv_CancelDelegationToken()
274
+ end
275
+
276
+ def send_CancelDelegationToken(req)
277
+ send_message('CancelDelegationToken', CancelDelegationToken_args, :req => req)
278
+ end
279
+
280
+ def recv_CancelDelegationToken()
281
+ result = receive_message(CancelDelegationToken_result)
282
+ return result.success unless result.success.nil?
283
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'CancelDelegationToken failed: unknown result')
284
+ end
285
+
286
+ def RenewDelegationToken(req)
287
+ send_RenewDelegationToken(req)
288
+ return recv_RenewDelegationToken()
289
+ end
290
+
291
+ def send_RenewDelegationToken(req)
292
+ send_message('RenewDelegationToken', RenewDelegationToken_args, :req => req)
293
+ end
294
+
295
+ def recv_RenewDelegationToken()
296
+ result = receive_message(RenewDelegationToken_result)
297
+ return result.success unless result.success.nil?
298
+ raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'RenewDelegationToken failed: unknown result')
299
+ end
300
+
256
301
  end
257
302
 
258
303
  class Processor
@@ -370,6 +415,27 @@ module Hive2
370
415
  write_result(result, oprot, 'FetchResults', seqid)
371
416
  end
372
417
 
418
+ def process_GetDelegationToken(seqid, iprot, oprot)
419
+ args = read_args(iprot, GetDelegationToken_args)
420
+ result = GetDelegationToken_result.new()
421
+ result.success = @handler.GetDelegationToken(args.req)
422
+ write_result(result, oprot, 'GetDelegationToken', seqid)
423
+ end
424
+
425
+ def process_CancelDelegationToken(seqid, iprot, oprot)
426
+ args = read_args(iprot, CancelDelegationToken_args)
427
+ result = CancelDelegationToken_result.new()
428
+ result.success = @handler.CancelDelegationToken(args.req)
429
+ write_result(result, oprot, 'CancelDelegationToken', seqid)
430
+ end
431
+
432
+ def process_RenewDelegationToken(seqid, iprot, oprot)
433
+ args = read_args(iprot, RenewDelegationToken_args)
434
+ result = RenewDelegationToken_result.new()
435
+ result.success = @handler.RenewDelegationToken(args.req)
436
+ write_result(result, oprot, 'RenewDelegationToken', seqid)
437
+ end
438
+
373
439
  end
374
440
 
375
441
  # HELPER FUNCTIONS AND STRUCTURES
@@ -886,6 +952,102 @@ module Hive2
886
952
  ::Thrift::Struct.generate_accessors self
887
953
  end
888
954
 
955
+ class GetDelegationToken_args
956
+ include ::Thrift::Struct, ::Thrift::Struct_Union
957
+ REQ = 1
958
+
959
+ FIELDS = {
960
+ REQ => {:type => ::Thrift::Types::STRUCT, :name => 'req', :class => ::Hive2::Thrift::TGetDelegationTokenReq}
961
+ }
962
+
963
+ def struct_fields; FIELDS; end
964
+
965
+ def validate
966
+ end
967
+
968
+ ::Thrift::Struct.generate_accessors self
969
+ end
970
+
971
+ class GetDelegationToken_result
972
+ include ::Thrift::Struct, ::Thrift::Struct_Union
973
+ SUCCESS = 0
974
+
975
+ FIELDS = {
976
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::Hive2::Thrift::TGetDelegationTokenResp}
977
+ }
978
+
979
+ def struct_fields; FIELDS; end
980
+
981
+ def validate
982
+ end
983
+
984
+ ::Thrift::Struct.generate_accessors self
985
+ end
986
+
987
+ class CancelDelegationToken_args
988
+ include ::Thrift::Struct, ::Thrift::Struct_Union
989
+ REQ = 1
990
+
991
+ FIELDS = {
992
+ REQ => {:type => ::Thrift::Types::STRUCT, :name => 'req', :class => ::Hive2::Thrift::TCancelDelegationTokenReq}
993
+ }
994
+
995
+ def struct_fields; FIELDS; end
996
+
997
+ def validate
998
+ end
999
+
1000
+ ::Thrift::Struct.generate_accessors self
1001
+ end
1002
+
1003
+ class CancelDelegationToken_result
1004
+ include ::Thrift::Struct, ::Thrift::Struct_Union
1005
+ SUCCESS = 0
1006
+
1007
+ FIELDS = {
1008
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::Hive2::Thrift::TCancelDelegationTokenResp}
1009
+ }
1010
+
1011
+ def struct_fields; FIELDS; end
1012
+
1013
+ def validate
1014
+ end
1015
+
1016
+ ::Thrift::Struct.generate_accessors self
1017
+ end
1018
+
1019
+ class RenewDelegationToken_args
1020
+ include ::Thrift::Struct, ::Thrift::Struct_Union
1021
+ REQ = 1
1022
+
1023
+ FIELDS = {
1024
+ REQ => {:type => ::Thrift::Types::STRUCT, :name => 'req', :class => ::Hive2::Thrift::TRenewDelegationTokenReq}
1025
+ }
1026
+
1027
+ def struct_fields; FIELDS; end
1028
+
1029
+ def validate
1030
+ end
1031
+
1032
+ ::Thrift::Struct.generate_accessors self
1033
+ end
1034
+
1035
+ class RenewDelegationToken_result
1036
+ include ::Thrift::Struct, ::Thrift::Struct_Union
1037
+ SUCCESS = 0
1038
+
1039
+ FIELDS = {
1040
+ SUCCESS => {:type => ::Thrift::Types::STRUCT, :name => 'success', :class => ::Hive2::Thrift::TRenewDelegationTokenResp}
1041
+ }
1042
+
1043
+ def struct_fields; FIELDS; end
1044
+
1045
+ def validate
1046
+ end
1047
+
1048
+ ::Thrift::Struct.generate_accessors self
1049
+ end
1050
+
889
1051
  end
890
1052
 
891
1053
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (0.9.0)
2
+ # Autogenerated by Thrift Compiler (0.9.1)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -24,6 +24,7 @@ module Hive2
24
24
  16,
25
25
  17,
26
26
  18,
27
+ 19,
27
28
  ])
28
29
 
29
30
  COMPLEX_TYPES = Set.new([
@@ -58,9 +59,14 @@ module Hive2
58
59
  16 => %q"NULL",
59
60
  17 => %q"DATE",
60
61
  18 => %q"VARCHAR",
62
+ 19 => %q"CHAR",
61
63
  }
62
64
 
63
65
  CHARACTER_MAXIMUM_LENGTH = %q"characterMaximumLength"
64
66
 
67
+ PRECISION = %q"precision"
68
+
69
+ SCALE = %q"scale"
70
+
65
71
  end
66
72
  end
@@ -1,5 +1,5 @@
1
1
  #
2
- # Autogenerated by Thrift Compiler (0.9.0)
2
+ # Autogenerated by Thrift Compiler (0.9.1)
3
3
  #
4
4
  # DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
5
  #
@@ -12,8 +12,12 @@ module Hive2
12
12
  HIVE_CLI_SERVICE_PROTOCOL_V1 = 0
13
13
  HIVE_CLI_SERVICE_PROTOCOL_V2 = 1
14
14
  HIVE_CLI_SERVICE_PROTOCOL_V3 = 2
15
- VALUE_MAP = {0 => "HIVE_CLI_SERVICE_PROTOCOL_V1", 1 => "HIVE_CLI_SERVICE_PROTOCOL_V2", 2 => "HIVE_CLI_SERVICE_PROTOCOL_V3"}
16
- VALID_VALUES = Set.new([HIVE_CLI_SERVICE_PROTOCOL_V1, HIVE_CLI_SERVICE_PROTOCOL_V2, HIVE_CLI_SERVICE_PROTOCOL_V3]).freeze
15
+ HIVE_CLI_SERVICE_PROTOCOL_V4 = 3
16
+ HIVE_CLI_SERVICE_PROTOCOL_V5 = 4
17
+ HIVE_CLI_SERVICE_PROTOCOL_V6 = 5
18
+ HIVE_CLI_SERVICE_PROTOCOL_V7 = 6
19
+ VALUE_MAP = {0 => "HIVE_CLI_SERVICE_PROTOCOL_V1", 1 => "HIVE_CLI_SERVICE_PROTOCOL_V2", 2 => "HIVE_CLI_SERVICE_PROTOCOL_V3", 3 => "HIVE_CLI_SERVICE_PROTOCOL_V4", 4 => "HIVE_CLI_SERVICE_PROTOCOL_V5", 5 => "HIVE_CLI_SERVICE_PROTOCOL_V6", 6 => "HIVE_CLI_SERVICE_PROTOCOL_V7"}
20
+ VALID_VALUES = Set.new([HIVE_CLI_SERVICE_PROTOCOL_V1, HIVE_CLI_SERVICE_PROTOCOL_V2, HIVE_CLI_SERVICE_PROTOCOL_V3, HIVE_CLI_SERVICE_PROTOCOL_V4, HIVE_CLI_SERVICE_PROTOCOL_V5, HIVE_CLI_SERVICE_PROTOCOL_V6, HIVE_CLI_SERVICE_PROTOCOL_V7]).freeze
17
21
  end
18
22
 
19
23
  module TTypeId
@@ -36,8 +40,9 @@ module Hive2
36
40
  NULL_TYPE = 16
37
41
  DATE_TYPE = 17
38
42
  VARCHAR_TYPE = 18
39
- VALUE_MAP = {0 => "BOOLEAN_TYPE", 1 => "TINYINT_TYPE", 2 => "SMALLINT_TYPE", 3 => "INT_TYPE", 4 => "BIGINT_TYPE", 5 => "FLOAT_TYPE", 6 => "DOUBLE_TYPE", 7 => "STRING_TYPE", 8 => "TIMESTAMP_TYPE", 9 => "BINARY_TYPE", 10 => "ARRAY_TYPE", 11 => "MAP_TYPE", 12 => "STRUCT_TYPE", 13 => "UNION_TYPE", 14 => "USER_DEFINED_TYPE", 15 => "DECIMAL_TYPE", 16 => "NULL_TYPE", 17 => "DATE_TYPE", 18 => "VARCHAR_TYPE"}
40
- VALID_VALUES = Set.new([BOOLEAN_TYPE, TINYINT_TYPE, SMALLINT_TYPE, INT_TYPE, BIGINT_TYPE, FLOAT_TYPE, DOUBLE_TYPE, STRING_TYPE, TIMESTAMP_TYPE, BINARY_TYPE, ARRAY_TYPE, MAP_TYPE, STRUCT_TYPE, UNION_TYPE, USER_DEFINED_TYPE, DECIMAL_TYPE, NULL_TYPE, DATE_TYPE, VARCHAR_TYPE]).freeze
43
+ CHAR_TYPE = 19
44
+ VALUE_MAP = {0 => "BOOLEAN_TYPE", 1 => "TINYINT_TYPE", 2 => "SMALLINT_TYPE", 3 => "INT_TYPE", 4 => "BIGINT_TYPE", 5 => "FLOAT_TYPE", 6 => "DOUBLE_TYPE", 7 => "STRING_TYPE", 8 => "TIMESTAMP_TYPE", 9 => "BINARY_TYPE", 10 => "ARRAY_TYPE", 11 => "MAP_TYPE", 12 => "STRUCT_TYPE", 13 => "UNION_TYPE", 14 => "USER_DEFINED_TYPE", 15 => "DECIMAL_TYPE", 16 => "NULL_TYPE", 17 => "DATE_TYPE", 18 => "VARCHAR_TYPE", 19 => "CHAR_TYPE"}
45
+ VALID_VALUES = Set.new([BOOLEAN_TYPE, TINYINT_TYPE, SMALLINT_TYPE, INT_TYPE, BIGINT_TYPE, FLOAT_TYPE, DOUBLE_TYPE, STRING_TYPE, TIMESTAMP_TYPE, BINARY_TYPE, ARRAY_TYPE, MAP_TYPE, STRUCT_TYPE, UNION_TYPE, USER_DEFINED_TYPE, DECIMAL_TYPE, NULL_TYPE, DATE_TYPE, VARCHAR_TYPE, CHAR_TYPE]).freeze
41
46
  end
42
47
 
43
48
  module TStatusCode
@@ -520,65 +525,6 @@ module Hive2
520
525
  ::Thrift::Struct.generate_accessors self
521
526
  end
522
527
 
523
- class TColumn < ::Thrift::Union
524
- include ::Thrift::Struct_Union
525
- class << self
526
- def boolColumn(val)
527
- TColumn.new(:boolColumn, val)
528
- end
529
-
530
- def byteColumn(val)
531
- TColumn.new(:byteColumn, val)
532
- end
533
-
534
- def i16Column(val)
535
- TColumn.new(:i16Column, val)
536
- end
537
-
538
- def i32Column(val)
539
- TColumn.new(:i32Column, val)
540
- end
541
-
542
- def i64Column(val)
543
- TColumn.new(:i64Column, val)
544
- end
545
-
546
- def doubleColumn(val)
547
- TColumn.new(:doubleColumn, val)
548
- end
549
-
550
- def stringColumn(val)
551
- TColumn.new(:stringColumn, val)
552
- end
553
- end
554
-
555
- BOOLCOLUMN = 1
556
- BYTECOLUMN = 2
557
- I16COLUMN = 3
558
- I32COLUMN = 4
559
- I64COLUMN = 5
560
- DOUBLECOLUMN = 6
561
- STRINGCOLUMN = 7
562
-
563
- FIELDS = {
564
- BOOLCOLUMN => {:type => ::Thrift::Types::LIST, :name => 'boolColumn', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Hive2::Thrift::TBoolValue}},
565
- BYTECOLUMN => {:type => ::Thrift::Types::LIST, :name => 'byteColumn', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Hive2::Thrift::TByteValue}},
566
- I16COLUMN => {:type => ::Thrift::Types::LIST, :name => 'i16Column', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Hive2::Thrift::TI16Value}},
567
- I32COLUMN => {:type => ::Thrift::Types::LIST, :name => 'i32Column', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Hive2::Thrift::TI32Value}},
568
- I64COLUMN => {:type => ::Thrift::Types::LIST, :name => 'i64Column', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Hive2::Thrift::TI64Value}},
569
- DOUBLECOLUMN => {:type => ::Thrift::Types::LIST, :name => 'doubleColumn', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Hive2::Thrift::TDoubleValue}},
570
- STRINGCOLUMN => {:type => ::Thrift::Types::LIST, :name => 'stringColumn', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Hive2::Thrift::TStringValue}}
571
- }
572
-
573
- def struct_fields; FIELDS; end
574
-
575
- def validate
576
- raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
577
- end
578
-
579
- ::Thrift::Union.generate_accessors self
580
- end
581
-
582
528
  class TColumnValue < ::Thrift::Union
583
529
  include ::Thrift::Struct_Union
584
530
  class << self
@@ -655,6 +601,231 @@ module Hive2
655
601
  ::Thrift::Struct.generate_accessors self
656
602
  end
657
603
 
604
+ class TBoolColumn
605
+ include ::Thrift::Struct, ::Thrift::Struct_Union
606
+ VALUES = 1
607
+ NULLS = 2
608
+
609
+ FIELDS = {
610
+ VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::BOOL}},
611
+ NULLS => {:type => ::Thrift::Types::STRING, :name => 'nulls', :binary => true}
612
+ }
613
+
614
+ def struct_fields; FIELDS; end
615
+
616
+ def validate
617
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field values is unset!') unless @values
618
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nulls is unset!') unless @nulls
619
+ end
620
+
621
+ ::Thrift::Struct.generate_accessors self
622
+ end
623
+
624
+ class TByteColumn
625
+ include ::Thrift::Struct, ::Thrift::Struct_Union
626
+ VALUES = 1
627
+ NULLS = 2
628
+
629
+ FIELDS = {
630
+ VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::BYTE}},
631
+ NULLS => {:type => ::Thrift::Types::STRING, :name => 'nulls', :binary => true}
632
+ }
633
+
634
+ def struct_fields; FIELDS; end
635
+
636
+ def validate
637
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field values is unset!') unless @values
638
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nulls is unset!') unless @nulls
639
+ end
640
+
641
+ ::Thrift::Struct.generate_accessors self
642
+ end
643
+
644
+ class TI16Column
645
+ include ::Thrift::Struct, ::Thrift::Struct_Union
646
+ VALUES = 1
647
+ NULLS = 2
648
+
649
+ FIELDS = {
650
+ VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::I16}},
651
+ NULLS => {:type => ::Thrift::Types::STRING, :name => 'nulls', :binary => true}
652
+ }
653
+
654
+ def struct_fields; FIELDS; end
655
+
656
+ def validate
657
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field values is unset!') unless @values
658
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nulls is unset!') unless @nulls
659
+ end
660
+
661
+ ::Thrift::Struct.generate_accessors self
662
+ end
663
+
664
+ class TI32Column
665
+ include ::Thrift::Struct, ::Thrift::Struct_Union
666
+ VALUES = 1
667
+ NULLS = 2
668
+
669
+ FIELDS = {
670
+ VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::I32}},
671
+ NULLS => {:type => ::Thrift::Types::STRING, :name => 'nulls', :binary => true}
672
+ }
673
+
674
+ def struct_fields; FIELDS; end
675
+
676
+ def validate
677
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field values is unset!') unless @values
678
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nulls is unset!') unless @nulls
679
+ end
680
+
681
+ ::Thrift::Struct.generate_accessors self
682
+ end
683
+
684
+ class TI64Column
685
+ include ::Thrift::Struct, ::Thrift::Struct_Union
686
+ VALUES = 1
687
+ NULLS = 2
688
+
689
+ FIELDS = {
690
+ VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::I64}},
691
+ NULLS => {:type => ::Thrift::Types::STRING, :name => 'nulls', :binary => true}
692
+ }
693
+
694
+ def struct_fields; FIELDS; end
695
+
696
+ def validate
697
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field values is unset!') unless @values
698
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nulls is unset!') unless @nulls
699
+ end
700
+
701
+ ::Thrift::Struct.generate_accessors self
702
+ end
703
+
704
+ class TDoubleColumn
705
+ include ::Thrift::Struct, ::Thrift::Struct_Union
706
+ VALUES = 1
707
+ NULLS = 2
708
+
709
+ FIELDS = {
710
+ VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::DOUBLE}},
711
+ NULLS => {:type => ::Thrift::Types::STRING, :name => 'nulls', :binary => true}
712
+ }
713
+
714
+ def struct_fields; FIELDS; end
715
+
716
+ def validate
717
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field values is unset!') unless @values
718
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nulls is unset!') unless @nulls
719
+ end
720
+
721
+ ::Thrift::Struct.generate_accessors self
722
+ end
723
+
724
+ class TStringColumn
725
+ include ::Thrift::Struct, ::Thrift::Struct_Union
726
+ VALUES = 1
727
+ NULLS = 2
728
+
729
+ FIELDS = {
730
+ VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::STRING}},
731
+ NULLS => {:type => ::Thrift::Types::STRING, :name => 'nulls', :binary => true}
732
+ }
733
+
734
+ def struct_fields; FIELDS; end
735
+
736
+ def validate
737
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field values is unset!') unless @values
738
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nulls is unset!') unless @nulls
739
+ end
740
+
741
+ ::Thrift::Struct.generate_accessors self
742
+ end
743
+
744
+ class TBinaryColumn
745
+ include ::Thrift::Struct, ::Thrift::Struct_Union
746
+ VALUES = 1
747
+ NULLS = 2
748
+
749
+ FIELDS = {
750
+ VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::STRING, :binary => true}},
751
+ NULLS => {:type => ::Thrift::Types::STRING, :name => 'nulls', :binary => true}
752
+ }
753
+
754
+ def struct_fields; FIELDS; end
755
+
756
+ def validate
757
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field values is unset!') unless @values
758
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field nulls is unset!') unless @nulls
759
+ end
760
+
761
+ ::Thrift::Struct.generate_accessors self
762
+ end
763
+
764
+ class TColumn < ::Thrift::Union
765
+ include ::Thrift::Struct_Union
766
+ class << self
767
+ def boolVal(val)
768
+ TColumn.new(:boolVal, val)
769
+ end
770
+
771
+ def byteVal(val)
772
+ TColumn.new(:byteVal, val)
773
+ end
774
+
775
+ def i16Val(val)
776
+ TColumn.new(:i16Val, val)
777
+ end
778
+
779
+ def i32Val(val)
780
+ TColumn.new(:i32Val, val)
781
+ end
782
+
783
+ def i64Val(val)
784
+ TColumn.new(:i64Val, val)
785
+ end
786
+
787
+ def doubleVal(val)
788
+ TColumn.new(:doubleVal, val)
789
+ end
790
+
791
+ def stringVal(val)
792
+ TColumn.new(:stringVal, val)
793
+ end
794
+
795
+ def binaryVal(val)
796
+ TColumn.new(:binaryVal, val)
797
+ end
798
+ end
799
+
800
+ BOOLVAL = 1
801
+ BYTEVAL = 2
802
+ I16VAL = 3
803
+ I32VAL = 4
804
+ I64VAL = 5
805
+ DOUBLEVAL = 6
806
+ STRINGVAL = 7
807
+ BINARYVAL = 8
808
+
809
+ FIELDS = {
810
+ BOOLVAL => {:type => ::Thrift::Types::STRUCT, :name => 'boolVal', :class => ::Hive2::Thrift::TBoolColumn},
811
+ BYTEVAL => {:type => ::Thrift::Types::STRUCT, :name => 'byteVal', :class => ::Hive2::Thrift::TByteColumn},
812
+ I16VAL => {:type => ::Thrift::Types::STRUCT, :name => 'i16Val', :class => ::Hive2::Thrift::TI16Column},
813
+ I32VAL => {:type => ::Thrift::Types::STRUCT, :name => 'i32Val', :class => ::Hive2::Thrift::TI32Column},
814
+ I64VAL => {:type => ::Thrift::Types::STRUCT, :name => 'i64Val', :class => ::Hive2::Thrift::TI64Column},
815
+ DOUBLEVAL => {:type => ::Thrift::Types::STRUCT, :name => 'doubleVal', :class => ::Hive2::Thrift::TDoubleColumn},
816
+ STRINGVAL => {:type => ::Thrift::Types::STRUCT, :name => 'stringVal', :class => ::Hive2::Thrift::TStringColumn},
817
+ BINARYVAL => {:type => ::Thrift::Types::STRUCT, :name => 'binaryVal', :class => ::Hive2::Thrift::TBinaryColumn}
818
+ }
819
+
820
+ def struct_fields; FIELDS; end
821
+
822
+ def validate
823
+ raise(StandardError, 'Union fields are not set.') if get_set_field.nil? || get_value.nil?
824
+ end
825
+
826
+ ::Thrift::Union.generate_accessors self
827
+ end
828
+
658
829
  class TRowSet
659
830
  include ::Thrift::Struct, ::Thrift::Struct_Union
660
831
  STARTROWOFFSET = 1
@@ -778,7 +949,7 @@ module Hive2
778
949
  CONFIGURATION = 4
779
950
 
780
951
  FIELDS = {
781
- CLIENT_PROTOCOL => {:type => ::Thrift::Types::I32, :name => 'client_protocol', :default => 2, :enum_class => ::Hive2::Thrift::TProtocolVersion},
952
+ CLIENT_PROTOCOL => {:type => ::Thrift::Types::I32, :name => 'client_protocol', :default => 5, :enum_class => ::Hive2::Thrift::TProtocolVersion},
782
953
  USERNAME => {:type => ::Thrift::Types::STRING, :name => 'username', :optional => true},
783
954
  PASSWORD => {:type => ::Thrift::Types::STRING, :name => 'password', :optional => true},
784
955
  CONFIGURATION => {:type => ::Thrift::Types::MAP, :name => 'configuration', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true}
@@ -805,7 +976,7 @@ module Hive2
805
976
 
806
977
  FIELDS = {
807
978
  STATUS => {:type => ::Thrift::Types::STRUCT, :name => 'status', :class => ::Hive2::Thrift::TStatus},
808
- SERVERPROTOCOLVERSION => {:type => ::Thrift::Types::I32, :name => 'serverProtocolVersion', :default => 2, :enum_class => ::Hive2::Thrift::TProtocolVersion},
979
+ SERVERPROTOCOLVERSION => {:type => ::Thrift::Types::I32, :name => 'serverProtocolVersion', :default => 5, :enum_class => ::Hive2::Thrift::TProtocolVersion},
809
980
  SESSIONHANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'sessionHandle', :class => ::Hive2::Thrift::TSessionHandle, :optional => true},
810
981
  CONFIGURATION => {:type => ::Thrift::Types::MAP, :name => 'configuration', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true}
811
982
  }
@@ -1296,10 +1467,16 @@ module Hive2
1296
1467
  include ::Thrift::Struct, ::Thrift::Struct_Union
1297
1468
  STATUS = 1
1298
1469
  OPERATIONSTATE = 2
1470
+ SQLSTATE = 3
1471
+ ERRORCODE = 4
1472
+ ERRORMESSAGE = 5
1299
1473
 
1300
1474
  FIELDS = {
1301
1475
  STATUS => {:type => ::Thrift::Types::STRUCT, :name => 'status', :class => ::Hive2::Thrift::TStatus},
1302
- OPERATIONSTATE => {:type => ::Thrift::Types::I32, :name => 'operationState', :optional => true, :enum_class => ::Hive2::Thrift::TOperationState}
1476
+ OPERATIONSTATE => {:type => ::Thrift::Types::I32, :name => 'operationState', :optional => true, :enum_class => ::Hive2::Thrift::TOperationState},
1477
+ SQLSTATE => {:type => ::Thrift::Types::STRING, :name => 'sqlState', :optional => true},
1478
+ ERRORCODE => {:type => ::Thrift::Types::I32, :name => 'errorCode', :optional => true},
1479
+ ERRORMESSAGE => {:type => ::Thrift::Types::STRING, :name => 'errorMessage', :optional => true}
1303
1480
  }
1304
1481
 
1305
1482
  def struct_fields; FIELDS; end
@@ -1465,5 +1642,121 @@ module Hive2
1465
1642
  ::Thrift::Struct.generate_accessors self
1466
1643
  end
1467
1644
 
1645
+ class TGetDelegationTokenReq
1646
+ include ::Thrift::Struct, ::Thrift::Struct_Union
1647
+ SESSIONHANDLE = 1
1648
+ OWNER = 2
1649
+ RENEWER = 3
1650
+
1651
+ FIELDS = {
1652
+ SESSIONHANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'sessionHandle', :class => ::Hive2::Thrift::TSessionHandle},
1653
+ OWNER => {:type => ::Thrift::Types::STRING, :name => 'owner'},
1654
+ RENEWER => {:type => ::Thrift::Types::STRING, :name => 'renewer'}
1655
+ }
1656
+
1657
+ def struct_fields; FIELDS; end
1658
+
1659
+ def validate
1660
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field sessionHandle is unset!') unless @sessionHandle
1661
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field owner is unset!') unless @owner
1662
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field renewer is unset!') unless @renewer
1663
+ end
1664
+
1665
+ ::Thrift::Struct.generate_accessors self
1666
+ end
1667
+
1668
+ class TGetDelegationTokenResp
1669
+ include ::Thrift::Struct, ::Thrift::Struct_Union
1670
+ STATUS = 1
1671
+ DELEGATIONTOKEN = 2
1672
+
1673
+ FIELDS = {
1674
+ STATUS => {:type => ::Thrift::Types::STRUCT, :name => 'status', :class => ::Hive2::Thrift::TStatus},
1675
+ DELEGATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'delegationToken', :optional => true}
1676
+ }
1677
+
1678
+ def struct_fields; FIELDS; end
1679
+
1680
+ def validate
1681
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field status is unset!') unless @status
1682
+ end
1683
+
1684
+ ::Thrift::Struct.generate_accessors self
1685
+ end
1686
+
1687
+ class TCancelDelegationTokenReq
1688
+ include ::Thrift::Struct, ::Thrift::Struct_Union
1689
+ SESSIONHANDLE = 1
1690
+ DELEGATIONTOKEN = 2
1691
+
1692
+ FIELDS = {
1693
+ SESSIONHANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'sessionHandle', :class => ::Hive2::Thrift::TSessionHandle},
1694
+ DELEGATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'delegationToken'}
1695
+ }
1696
+
1697
+ def struct_fields; FIELDS; end
1698
+
1699
+ def validate
1700
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field sessionHandle is unset!') unless @sessionHandle
1701
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field delegationToken is unset!') unless @delegationToken
1702
+ end
1703
+
1704
+ ::Thrift::Struct.generate_accessors self
1705
+ end
1706
+
1707
+ class TCancelDelegationTokenResp
1708
+ include ::Thrift::Struct, ::Thrift::Struct_Union
1709
+ STATUS = 1
1710
+
1711
+ FIELDS = {
1712
+ STATUS => {:type => ::Thrift::Types::STRUCT, :name => 'status', :class => ::Hive2::Thrift::TStatus}
1713
+ }
1714
+
1715
+ def struct_fields; FIELDS; end
1716
+
1717
+ def validate
1718
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field status is unset!') unless @status
1719
+ end
1720
+
1721
+ ::Thrift::Struct.generate_accessors self
1722
+ end
1723
+
1724
+ class TRenewDelegationTokenReq
1725
+ include ::Thrift::Struct, ::Thrift::Struct_Union
1726
+ SESSIONHANDLE = 1
1727
+ DELEGATIONTOKEN = 2
1728
+
1729
+ FIELDS = {
1730
+ SESSIONHANDLE => {:type => ::Thrift::Types::STRUCT, :name => 'sessionHandle', :class => ::Hive2::Thrift::TSessionHandle},
1731
+ DELEGATIONTOKEN => {:type => ::Thrift::Types::STRING, :name => 'delegationToken'}
1732
+ }
1733
+
1734
+ def struct_fields; FIELDS; end
1735
+
1736
+ def validate
1737
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field sessionHandle is unset!') unless @sessionHandle
1738
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field delegationToken is unset!') unless @delegationToken
1739
+ end
1740
+
1741
+ ::Thrift::Struct.generate_accessors self
1742
+ end
1743
+
1744
+ class TRenewDelegationTokenResp
1745
+ include ::Thrift::Struct, ::Thrift::Struct_Union
1746
+ STATUS = 1
1747
+
1748
+ FIELDS = {
1749
+ STATUS => {:type => ::Thrift::Types::STRUCT, :name => 'status', :class => ::Hive2::Thrift::TStatus}
1750
+ }
1751
+
1752
+ def struct_fields; FIELDS; end
1753
+
1754
+ def validate
1755
+ raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field status is unset!') unless @status
1756
+ end
1757
+
1758
+ ::Thrift::Struct.generate_accessors self
1759
+ end
1760
+
1468
1761
  end
1469
1762
  end
data/rbhive.gemspec CHANGED
@@ -20,4 +20,8 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency('thrift', '= 0.9.0')
22
22
  spec.add_dependency('json')
23
+
24
+ spec.add_development_dependency "rake"
25
+ spec.add_development_dependency "bundler", ">= 1.3"
26
+
23
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbhive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.3
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-01-31 00:00:00.000000000 Z
13
+ date: 2014-03-28 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: thrift
@@ -44,6 +44,38 @@ dependencies:
44
44
  - - ! '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ - !ruby/object:Gem::Dependency
64
+ name: bundler
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '1.3'
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '1.3'
47
79
  description: Simple gem for executing Hive queries and collecting the results
48
80
  email:
49
81
  - andy@forward.co.uk
@@ -54,8 +86,11 @@ extensions: []
54
86
  extra_rdoc_files: []
55
87
  files:
56
88
  - .gitignore
89
+ - CHANGELOG.md
90
+ - Gemfile
57
91
  - LICENSE
58
92
  - README.md
93
+ - Rakefile
59
94
  - lib/rbhive.rb
60
95
  - lib/rbhive/connection.rb
61
96
  - lib/rbhive/explain_result.rb
@@ -97,12 +132,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
132
  - - ! '>='
98
133
  - !ruby/object:Gem::Version
99
134
  version: '0'
135
+ segments:
136
+ - 0
137
+ hash: 2810079357689827941
100
138
  required_rubygems_version: !ruby/object:Gem::Requirement
101
139
  none: false
102
140
  requirements:
103
141
  - - ! '>='
104
142
  - !ruby/object:Gem::Version
105
143
  version: '0'
144
+ segments:
145
+ - 0
146
+ hash: 2810079357689827941
106
147
  requirements: []
107
148
  rubyforge_project:
108
149
  rubygems_version: 1.8.23