mobilize-hive 1.297 → 1.298
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/mobilize-hive/handlers/hive.rb +14 -3
- data/lib/mobilize-hive/version.rb +1 -1
- data/mobilize-hive.gemspec +1 -1
- data/test/hive_job_rows.yml +1 -1
- metadata +6 -6
|
@@ -248,6 +248,7 @@ module Mobilize
|
|
|
248
248
|
def Hive.hql_to_table(cluster, db, table, part_array, source_hql, user_name, job_name, drop=false, schema_hash=nil)
|
|
249
249
|
table_path = [db,table].join(".")
|
|
250
250
|
table_stats = Hive.table_stats(cluster, db, table, user_name)
|
|
251
|
+
url = "hive://" + [cluster,db,table,part_array.compact.join("/")].join("/")
|
|
251
252
|
|
|
252
253
|
source_hql_array = source_hql.split(";")
|
|
253
254
|
last_select_i = source_hql_array.rindex{|hql| hql.downcase.strip.starts_with?("select")}
|
|
@@ -359,6 +360,12 @@ module Mobilize
|
|
|
359
360
|
part_perm_tsv = response['stdout']
|
|
360
361
|
#having gotten the permutations, ensure they are dropped
|
|
361
362
|
part_hash_array = part_perm_tsv.tsv_to_hash_array
|
|
363
|
+
#make sure there is data
|
|
364
|
+
if part_hash_array.first.nil? or part_hash_array.first.values.include?(nil)
|
|
365
|
+
#blank result set, return url
|
|
366
|
+
return url
|
|
367
|
+
end
|
|
368
|
+
|
|
362
369
|
part_drop_hql = part_hash_array.map do |h|
|
|
363
370
|
part_drop_stmt = h.map do |name,value|
|
|
364
371
|
part_defs[name[1..-2]]=="string" ? "#{name}='#{value}'" : "#{name}=#{value}"
|
|
@@ -380,7 +387,6 @@ module Mobilize
|
|
|
380
387
|
error_msg = "Incompatible partition specs"
|
|
381
388
|
raise error_msg
|
|
382
389
|
end
|
|
383
|
-
url = "hive://" + [cluster,db,table,part_array.compact.join("/")].join("/")
|
|
384
390
|
return url
|
|
385
391
|
end
|
|
386
392
|
|
|
@@ -389,6 +395,11 @@ module Mobilize
|
|
|
389
395
|
#also schema with column datatype overrides
|
|
390
396
|
def Hive.tsv_to_table(cluster, db, table, part_array, source_tsv, user_name, drop=false, schema_hash=nil)
|
|
391
397
|
return nil if source_tsv.strip.length==0
|
|
398
|
+
if source_tsv.index("\r\n")
|
|
399
|
+
source_tsv = source_tsv.gsub("\r\n","\n")
|
|
400
|
+
elsif source_tsv.index("\r")
|
|
401
|
+
source_tsv = source_tsv.gsub("\r","\n")
|
|
402
|
+
end
|
|
392
403
|
source_headers = source_tsv.tsv_header_array
|
|
393
404
|
|
|
394
405
|
table_path = [db,table].join(".")
|
|
@@ -541,11 +552,11 @@ module Mobilize
|
|
|
541
552
|
#source table
|
|
542
553
|
cluster,source_path = source.path.split("/").ie{|sp| [sp.first, sp[1..-1].join(".")]}
|
|
543
554
|
source_hql = "select * from #{source_path};"
|
|
544
|
-
elsif ['gsheet','gridfs','hdfs'].include?(source.handler)
|
|
555
|
+
elsif ['gsheet','gfile','gridfs','hdfs'].include?(source.handler)
|
|
545
556
|
if source.path.ie{|sdp| sdp.index(/\.[A-Za-z]ql$/) or sdp.ends_with?(".ql")}
|
|
546
557
|
source_hql = source.read(user_name,gdrive_slot)
|
|
547
558
|
else
|
|
548
|
-
#tsv from sheet
|
|
559
|
+
#tsv from sheet or file
|
|
549
560
|
source_tsv = source.read(user_name,gdrive_slot)
|
|
550
561
|
end
|
|
551
562
|
end
|
data/mobilize-hive.gemspec
CHANGED
|
@@ -16,5 +16,5 @@ Gem::Specification.new do |gem|
|
|
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
|
17
17
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
18
18
|
gem.require_paths = ["lib"]
|
|
19
|
-
gem.add_runtime_dependency "mobilize-hdfs","1.
|
|
19
|
+
gem.add_runtime_dependency "mobilize-hdfs","1.298"
|
|
20
20
|
end
|
data/test/hive_job_rows.yml
CHANGED
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
stage4: gsheet.write source:"hive://mobilize/hive_test_3", target:"hive_test_3.out"
|
|
27
27
|
- name: hive_test_4
|
|
28
28
|
active: true
|
|
29
|
-
trigger: after
|
|
29
|
+
trigger: after hive_test_3
|
|
30
30
|
status: ""
|
|
31
31
|
stage1: hive.write source:"hive_test_4_stage_1.in", target:"mobilize/hive_test_1", partitions:"act_date"
|
|
32
32
|
stage2: hive.write source:"hive_test_4_stage_2.in", target:"mobilize/hive_test_1", partitions:"act_date"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mobilize-hive
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: '1.
|
|
4
|
+
version: '1.298'
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2013-04-
|
|
12
|
+
date: 2013-04-17 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: mobilize-hdfs
|
|
@@ -18,7 +18,7 @@ dependencies:
|
|
|
18
18
|
requirements:
|
|
19
19
|
- - '='
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: '1.
|
|
21
|
+
version: '1.298'
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -26,7 +26,7 @@ dependencies:
|
|
|
26
26
|
requirements:
|
|
27
27
|
- - '='
|
|
28
28
|
- !ruby/object:Gem::Version
|
|
29
|
-
version: '1.
|
|
29
|
+
version: '1.298'
|
|
30
30
|
description: Adds hive read, write, and run support to mobilize-hdfs
|
|
31
31
|
email:
|
|
32
32
|
- cpaesleme@dena.com
|
|
@@ -66,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
66
66
|
version: '0'
|
|
67
67
|
segments:
|
|
68
68
|
- 0
|
|
69
|
-
hash:
|
|
69
|
+
hash: 1394133607903248824
|
|
70
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
71
|
none: false
|
|
72
72
|
requirements:
|
|
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
75
75
|
version: '0'
|
|
76
76
|
segments:
|
|
77
77
|
- 0
|
|
78
|
-
hash:
|
|
78
|
+
hash: 1394133607903248824
|
|
79
79
|
requirements: []
|
|
80
80
|
rubyforge_project:
|
|
81
81
|
rubygems_version: 1.8.25
|