mobilize-hive 1.299 → 1.351

Sign up to get free protection for your applications and to get access to all the features.
@@ -101,7 +101,7 @@ module Mobilize
101
101
  file_hash[filename] = hql
102
102
  #add in default params
103
103
  params ||= {}
104
- params.merge(Ssh.default_params)
104
+ params = params.merge(Hive.default_params)
105
105
  #replace any params in the file_hash and command
106
106
  params.each do |k,v|
107
107
  file_hash.each do |name,data|
@@ -303,7 +303,7 @@ module Mobilize
303
303
 
304
304
  target_set_hql = ["set mapred.job.name=#{job_name};",
305
305
  "set hive.exec.dynamic.partition.mode=nonstrict;",
306
- "set hive.exec.max.dynamic.partitions.pernode=1000;",
306
+ "set hive.exec.max.dynamic.partitions.pernode=10000;",
307
307
  "set hive.exec.dynamic.partition=true;",
308
308
  "set hive.exec.max.created.files = 200000;",
309
309
  "set hive.max.created.files = 200000;"].join
@@ -516,7 +516,7 @@ module Mobilize
516
516
  #source table
517
517
  cluster,source_path = source.path.split("/").ie{|sp| [sp.first, sp[1..-1].join(".")]}
518
518
  source_hql = "select * from #{source_path};"
519
- elsif ['gsheet','gfile','gridfs','hdfs'].include?(source.handler)
519
+ else
520
520
  if source.path.ie{|sdp| sdp.index(/\.[A-Za-z]ql$/) or sdp.ends_with?(".ql")}
521
521
  source_hql = source.read(user_name,gdrive_slot)
522
522
  else
@@ -542,7 +542,8 @@ module Mobilize
542
542
 
543
543
  result = begin
544
544
  url = if source_hql
545
- Hive.hql_to_table(cluster, db, table, part_array, source_hql, user_name, job_name, drop, schema_hash)
545
+ #include any params (or nil) at the end
546
+ Hive.hql_to_table(cluster, db, table, part_array, source_hql, user_name, job_name, drop, schema_hash,params['params'])
546
547
  elsif source_tsv
547
548
  Hive.tsv_to_table(cluster, db, table, part_array, source_tsv, user_name, drop, schema_hash)
548
549
  elsif source
@@ -50,6 +50,14 @@ module Mobilize
50
50
  def self.databases(cluster,user_name)
51
51
  self.run(cluster,"show databases",user_name)['stdout'].split("\n")
52
52
  end
53
+
54
+ def self.default_params
55
+ time = Time.now.utc
56
+ {
57
+ '$utc_date'=>time.strftime("%Y-%m-%d"),
58
+ '$utc_time'=>time.strftime("%H:%M"),
59
+ }
60
+ end
53
61
  end
54
62
  end
55
63
 
@@ -1,5 +1,5 @@
1
1
  module Mobilize
2
2
  module Hive
3
- VERSION = "1.299"
3
+ VERSION = "1.351"
4
4
  end
5
5
  end
@@ -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.298"
19
+ gem.add_runtime_dependency "mobilize-hdfs","1.351"
20
20
  end
@@ -30,3 +30,5 @@
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"
33
+ stage3: hive.run hql:"select '$utc_date $utc_time' as `date_time`,product,category,value from mobilize.hive_test_1;"
34
+ stage4: gsheet.write source:stage3, target:"hive_test_4.out"
@@ -63,6 +63,8 @@ describe "Mobilize" do
63
63
  [hive_2_target_sheet].each{|s| s.delete if s}
64
64
  hive_3_target_sheet = Mobilize::Gsheet.find_by_path("#{r.path.split("/")[0..-2].join("/")}/hive_test_3.out",gdrive_slot)
65
65
  [hive_3_target_sheet].each{|s| s.delete if s}
66
+ hive_4_target_sheet = Mobilize::Gsheet.find_by_path("#{r.path.split("/")[0..-2].join("/")}/hive_test_4.out",gdrive_slot)
67
+ [hive_4_target_sheet].each{|s| s.delete if s}
66
68
 
67
69
  puts "job row added, force enqueued requestor, wait for stages"
68
70
  r.enqueue!
@@ -73,11 +75,13 @@ describe "Mobilize" do
73
75
  hive_1_stage_3_target_sheet = Mobilize::Gsheet.find_by_path("#{r.path.split("/")[0..-2].join("/")}/hive_test_1_stage_3.out",gdrive_slot)
74
76
  hive_2_target_sheet = Mobilize::Gsheet.find_by_path("#{r.path.split("/")[0..-2].join("/")}/hive_test_2.out",gdrive_slot)
75
77
  hive_3_target_sheet = Mobilize::Gsheet.find_by_path("#{r.path.split("/")[0..-2].join("/")}/hive_test_3.out",gdrive_slot)
78
+ hive_4_target_sheet = Mobilize::Gsheet.find_by_path("#{r.path.split("/")[0..-2].join("/")}/hive_test_4.out",gdrive_slot)
76
79
 
77
80
  assert hive_1_stage_2_target_sheet.read(u.name).length == 219
78
81
  assert hive_1_stage_3_target_sheet.read(u.name).length > 3
79
82
  assert hive_2_target_sheet.read(u.name).length == 599
80
83
  assert hive_3_target_sheet.read(u.name).length == 347
84
+ assert hive_4_target_sheet.read(u.name).length == 432
81
85
  end
82
86
 
83
87
  def wait_for_stages(time_limit=600,stage_limit=120,wait_length=10)
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.299'
4
+ version: '1.351'
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-17 00:00:00.000000000 Z
12
+ date: 2013-04-25 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.298'
21
+ version: '1.351'
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.298'
29
+ version: '1.351'
30
30
  description: Adds hive read, write, and run support to mobilize-hdfs
31
31
  email:
32
32
  - cpaesleme@dena.com
@@ -67,7 +67,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
67
67
  version: '0'
68
68
  segments:
69
69
  - 0
70
- hash: -3388772007190329704
70
+ hash: -249273093332881580
71
71
  required_rubygems_version: !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
76
  version: '0'
77
77
  segments:
78
78
  - 0
79
- hash: -3388772007190329704
79
+ hash: -249273093332881580
80
80
  requirements: []
81
81
  rubyforge_project:
82
82
  rubygems_version: 1.8.25