rbhive 1.0.0 → 1.0.1.pre

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.
@@ -2,12 +2,6 @@
2
2
 
3
3
  Versioning prior to 0.5.3 was not tracked, so this changelog only lists changes introduced after 0.5.3.
4
4
 
5
- ## 1.0.0
6
-
7
- * Asynchronous execution with Hiveserver2
8
- * Misc bugfixes
9
-
10
-
11
5
  ## 0.6.0
12
6
 
13
7
  0.6.0 introduces one backwards-incompatible change:
data/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  # RBHive - A Ruby Thrift client for Apache Hive
2
2
 
3
- [![Code Climate](https://codeclimate.com/github/forward3d/rbhive/badges/gpa.svg)](https://codeclimate.com/github/forward3d/rbhive)
4
-
5
3
  RBHive is a simple Ruby gem to communicate with the [Apache Hive](http://hive.apache.org)
6
4
  Thrift servers.
7
5
 
@@ -4,34 +4,34 @@ module RBHive
4
4
  @schema = schema
5
5
  super(rows.map {|r| @schema.coerce_row(r) })
6
6
  end
7
-
7
+
8
8
  def column_names
9
9
  @schema.column_names
10
10
  end
11
-
11
+
12
12
  def column_type_map
13
13
  @schema.column_type_map
14
14
  end
15
-
15
+
16
16
  def to_csv(out_file=nil)
17
- to_separated_output(",", out_file)
17
+ to_seperated_output(",", out_file)
18
18
  end
19
-
19
+
20
20
  def to_tsv(out_file=nil)
21
- to_separated_output("\t", out_file)
21
+ to_seperated_output("\t", out_file)
22
22
  end
23
-
23
+
24
24
  def as_arrays
25
25
  @as_arrays ||= self.map{ |r| @schema.coerce_row_to_array(r) }
26
26
  end
27
-
27
+
28
28
  private
29
-
30
- def to_separated_output(sep, out_file)
29
+
30
+ def to_seperated_output(sep, out_file)
31
31
  rows = self.map { |r| @schema.coerce_row_to_array(r).join(sep) }
32
32
  sv = rows.join("\n")
33
33
  return sv if out_file.nil?
34
34
  File.open(out_file, 'w+') { |f| f << sv }
35
35
  end
36
36
  end
37
- end
37
+ end
@@ -192,16 +192,14 @@ module RBHive
192
192
  # Async execute
193
193
  def async_execute(query)
194
194
  @logger.info("Executing query asynchronously: #{query}")
195
- exec_result = @client.ExecuteStatement(
195
+ op_handle = @client.ExecuteStatement(
196
196
  Hive2::Thrift::TExecuteStatementReq.new(
197
197
  sessionHandle: @session.sessionHandle,
198
198
  statement: query,
199
199
  runAsync: true
200
200
  )
201
- )
202
- raise_error_if_failed!(exec_result)
203
- op_handle = exec_result.operationHandle
204
-
201
+ ).operationHandle
202
+
205
203
  # Return handles to get hold of this query / session again
206
204
  {
207
205
  session: @session.sessionHandle,
@@ -238,7 +236,7 @@ module RBHive
238
236
  response = @client.GetOperationStatus(
239
237
  Hive2::Thrift::TGetOperationStatusReq.new(operationHandle: prepare_operation_handle(handles))
240
238
  )
241
-
239
+ puts response.operationState
242
240
  case response.operationState
243
241
  when Hive2::Thrift::TOperationState::FINISHED_STATE
244
242
  return :finished
@@ -433,9 +431,7 @@ module RBHive
433
431
  def raise_error_if_failed!(result)
434
432
  return if result.status.statusCode == 0
435
433
  error_message = result.status.errorMessage || 'Execution failed!'
436
- raise RBHive::TCLIConnectionError.new(error_message)
434
+ raise error_message
437
435
  end
438
436
  end
439
-
440
- class TCLIConnectionError < StandardError; end
441
437
  end
@@ -9,6 +9,7 @@ module RBHive
9
9
  TYPES = {
10
10
  :boolean => :to_s,
11
11
  :string => :to_s,
12
+ :bigint => :to_i,
12
13
  :float => :to_f,
13
14
  :double => :to_f,
14
15
  :int => :to_i,
@@ -8,7 +8,6 @@ module RBHive
8
8
  @field_sep = options[:field_sep] || "\t"
9
9
  @line_sep = options[:line_sep] || "\n"
10
10
  @collection_sep = options[:collection_sep] || "|"
11
- @stored_as = options[:stored_as] || :textfile
12
11
  @columns = []
13
12
  @partitions = []
14
13
  @serde_name = nil
@@ -32,14 +31,10 @@ module RBHive
32
31
  def create_table_statement()
33
32
  %[CREATE #{external}TABLE #{table_statement}
34
33
  ROW FORMAT #{row_format_statement}
35
- STORED AS #{stored_as}
34
+ STORED AS TEXTFILE
36
35
  #{location}]
37
36
  end
38
37
 
39
- def stored_as
40
- @stored_as.to_s.upcase
41
- end
42
-
43
38
  def row_format_statement
44
39
  if @serde_name
45
40
  serde_statement
@@ -1,3 +1,3 @@
1
1
  module RBHive
2
- VERSION = '1.0.0'
2
+ VERSION = '1.0.1.pre'
3
3
  end
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
  spec.authors = %w(Forward3D KolobocK)
10
10
  spec.description = 'Simple gem for executing Hive queries and collecting the results'
11
11
  spec.summary = 'Simple gem for executing Hive queries'
12
- spec.email = ['developers@forward3d.com', 'kolobock@gmail.com']
12
+ spec.email = ['andy@forward.co.uk', 'kolobock@gmail.com', 'developers@forward3d.com']
13
13
  spec.homepage = 'http://github.com/forward3d/rbhive'
14
14
  spec.license = 'MIT'
15
15
 
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency('thrift', '~> 0.9')
21
+ spec.add_dependency('thrift', '= 0.9.0')
22
22
  spec.add_dependency('json')
23
23
 
24
24
  spec.add_development_dependency 'rake'
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbhive
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1.pre
5
+ prerelease: 6
5
6
  platform: ruby
6
7
  authors:
7
8
  - Forward3D
@@ -9,73 +10,82 @@ authors:
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2018-12-17 00:00:00.000000000 Z
13
+ date: 2014-07-31 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: thrift
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
- - - "~>"
20
+ - - '='
19
21
  - !ruby/object:Gem::Version
20
- version: '0.9'
22
+ version: 0.9.0
21
23
  type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
- - - "~>"
28
+ - - '='
26
29
  - !ruby/object:Gem::Version
27
- version: '0.9'
30
+ version: 0.9.0
28
31
  - !ruby/object:Gem::Dependency
29
32
  name: json
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
- - - ">="
36
+ - - ! '>='
33
37
  - !ruby/object:Gem::Version
34
38
  version: '0'
35
39
  type: :runtime
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
- - - ">="
44
+ - - ! '>='
40
45
  - !ruby/object:Gem::Version
41
46
  version: '0'
42
47
  - !ruby/object:Gem::Dependency
43
48
  name: rake
44
49
  requirement: !ruby/object:Gem::Requirement
50
+ none: false
45
51
  requirements:
46
- - - ">="
52
+ - - ! '>='
47
53
  - !ruby/object:Gem::Version
48
54
  version: '0'
49
55
  type: :development
50
56
  prerelease: false
51
57
  version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
52
59
  requirements:
53
- - - ">="
60
+ - - ! '>='
54
61
  - !ruby/object:Gem::Version
55
62
  version: '0'
56
63
  - !ruby/object:Gem::Dependency
57
64
  name: bundler
58
65
  requirement: !ruby/object:Gem::Requirement
66
+ none: false
59
67
  requirements:
60
- - - ">="
68
+ - - ! '>='
61
69
  - !ruby/object:Gem::Version
62
70
  version: '1.3'
63
71
  type: :development
64
72
  prerelease: false
65
73
  version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
66
75
  requirements:
67
- - - ">="
76
+ - - ! '>='
68
77
  - !ruby/object:Gem::Version
69
78
  version: '1.3'
70
79
  description: Simple gem for executing Hive queries and collecting the results
71
80
  email:
72
- - developers@forward3d.com
81
+ - andy@forward.co.uk
73
82
  - kolobock@gmail.com
83
+ - developers@forward3d.com
74
84
  executables: []
75
85
  extensions: []
76
86
  extra_rdoc_files: []
77
87
  files:
78
- - ".gitignore"
88
+ - .gitignore
79
89
  - CHANGELOG.md
80
90
  - Gemfile
81
91
  - LICENSE
@@ -112,25 +122,29 @@ files:
112
122
  homepage: http://github.com/forward3d/rbhive
113
123
  licenses:
114
124
  - MIT
115
- metadata: {}
116
125
  post_install_message:
117
126
  rdoc_options: []
118
127
  require_paths:
119
128
  - lib
120
129
  required_ruby_version: !ruby/object:Gem::Requirement
130
+ none: false
121
131
  requirements:
122
- - - ">="
132
+ - - ! '>='
123
133
  - !ruby/object:Gem::Version
124
134
  version: '0'
135
+ segments:
136
+ - 0
137
+ hash: -635025961538808384
125
138
  required_rubygems_version: !ruby/object:Gem::Requirement
139
+ none: false
126
140
  requirements:
127
- - - ">="
141
+ - - ! '>'
128
142
  - !ruby/object:Gem::Version
129
- version: '0'
143
+ version: 1.3.1
130
144
  requirements: []
131
145
  rubyforge_project:
132
- rubygems_version: 2.6.11
146
+ rubygems_version: 1.8.23
133
147
  signing_key:
134
- specification_version: 4
148
+ specification_version: 3
135
149
  summary: Simple gem for executing Hive queries
136
150
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 224509bb79d39f4f06ec081b96e96a4cbb3be341
4
- data.tar.gz: f4df37b710b762c9f49238ba34e281773e7e7976
5
- SHA512:
6
- metadata.gz: 26a94f954cf6c76bbb6ed0ad345d56798beef6a933a756bba7778c1be5d66969606237052c0aed44978ecb073ad46836af0f830529220baec18f8d1f20e64fc8
7
- data.tar.gz: ba9b396a9fcf388712cf5deefe2f9a16120fffc117b3e53631702f4a1d7df872d8bd209b8e0b1cedd485b6af364854b0a25577cd06ee8718fbee7363110eae6a