embulk-output-vertica 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile +0 -1
- data/README.md +2 -2
- data/embulk-output-vertica.gemspec +1 -1
- data/lib/embulk/output/vertica/output_thread.rb +25 -7
- data/lib/embulk/output/vertica/value_converter_factory.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffcbf6b8e38f5b340f40ef6276d1d60eec24e7d1
|
4
|
+
data.tar.gz: 1db857854d517fa3121c212e779cc7cb7fd1a888
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 465771451e26a38c2d50278422aec461856b3301cc0dc4bf3a06a57e4520723c88a75abfa94e284e0195903015404d32377555722fc92a3e7c0a5a85004a8fb5
|
7
|
+
data.tar.gz: 0eed14f90d9a8ea9e3080282a653e90f90120fdb347f2cd5958d6e11f497b75d95e656bc2174559ba93452c0324194cc33b5c3d976350b0f27944cd52ce087f5
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "embulk-output-vertica"
|
3
|
-
spec.version = "0.5.
|
3
|
+
spec.version = "0.5.2"
|
4
4
|
spec.authors = ["eiji.sekiya", "Naotoshi Seo"]
|
5
5
|
spec.email = ["eiji.sekiya.0326@gmail.com", "sonots@gmail.com"]
|
6
6
|
spec.summary = "Vertica output plugin for Embulk"
|
@@ -35,15 +35,17 @@ module Embulk
|
|
35
35
|
@num_input_rows = 0
|
36
36
|
@num_output_rows = 0
|
37
37
|
@num_rejected_rows = 0
|
38
|
+
@outer_thread = Thread.current
|
39
|
+
@thread_active = false
|
38
40
|
end
|
39
41
|
|
40
42
|
def enqueue(page)
|
41
|
-
if @thread.
|
42
|
-
@thread.join # raise the same error raised inside thread
|
43
|
-
end
|
44
|
-
if @thread.alive?
|
43
|
+
if @thread_active and @thread.alive?
|
45
44
|
Embulk.logger.trace { "embulk-output-vertica: enqueued" }
|
46
45
|
@queue.push(page)
|
46
|
+
else
|
47
|
+
Embulk.logger.info { "embulk-output-vertica: thread is dead, but still trying to enqueue" }
|
48
|
+
raise RuntimeError, "embulk-output-vertica: thread is died, but still trying to enqueue"
|
47
49
|
end
|
48
50
|
end
|
49
51
|
|
@@ -81,18 +83,34 @@ module Embulk
|
|
81
83
|
Embulk.logger.warn "embulk-output-vertica: ROLLBACK!"
|
82
84
|
end
|
83
85
|
raise e # die transaction
|
86
|
+
rescue => e
|
87
|
+
Embulk.logger.warn "embulk-output-vertica: ROLLBACK!"
|
88
|
+
jv.rollback
|
89
|
+
raise e
|
84
90
|
end
|
85
91
|
end
|
92
|
+
rescue => e
|
93
|
+
@thread_active = false # not to be enqueued any more
|
94
|
+
while @queue.size > 0
|
95
|
+
@queue.pop # dequeue all because some might be still trying @queue.push and get blocked, need to release
|
96
|
+
end
|
97
|
+
@outer_thread.raise e.class.new("#{e.message}\n #{e.backtrace.join("\n ")}")
|
86
98
|
end
|
87
99
|
|
88
100
|
def start
|
89
101
|
@thread = Thread.new(&method(:run))
|
102
|
+
@thread_active = true
|
90
103
|
end
|
91
104
|
|
92
105
|
def commit
|
93
|
-
@
|
94
|
-
|
95
|
-
|
106
|
+
@thread_active = false
|
107
|
+
if @thread.alive?
|
108
|
+
@queue.push('finish')
|
109
|
+
Thread.pass
|
110
|
+
@thread.join
|
111
|
+
else
|
112
|
+
raise RuntimeError, "embulk-output-vertica: thread died accidently"
|
113
|
+
end
|
96
114
|
|
97
115
|
task_report = {
|
98
116
|
'num_input_rows' => @num_input_rows,
|
@@ -61,7 +61,7 @@ module Embulk
|
|
61
61
|
when 'long' then Proc.new {|val| val }
|
62
62
|
when 'double' then Proc.new {|val| val.to_f }
|
63
63
|
when 'string' then Proc.new {|val| val.to_s }
|
64
|
-
when 'timestamp' then Proc.new {|val| Time.at(val).localtime(zone_offset) }
|
64
|
+
when 'timestamp' then Proc.new {|val| val ? Time.at(val).localtime(zone_offset) : nil }
|
65
65
|
else raise NotSupportedType, "embulk-output-vertica cannot take column value_type #{value_type} for long column"
|
66
66
|
end
|
67
67
|
end
|
@@ -72,7 +72,7 @@ module Embulk
|
|
72
72
|
when 'long' then Proc.new {|val| val.to_i }
|
73
73
|
when 'double' then Proc.new {|val| val }
|
74
74
|
when 'string' then Proc.new {|val| val.to_s }
|
75
|
-
when 'timestamp' then Proc.new {|val| Time.at(val).localtime(zone_offset) }
|
75
|
+
when 'timestamp' then Proc.new {|val| val ? Time.at(val).localtime(zone_offset) : nil }
|
76
76
|
else raise NotSupportedType, "embulk-output-vertica cannot take column value_type #{value_type} for double column"
|
77
77
|
end
|
78
78
|
end
|
@@ -83,7 +83,7 @@ module Embulk
|
|
83
83
|
when 'long' then Proc.new {|val| val.to_i }
|
84
84
|
when 'double' then Proc.new {|val| val.to_f }
|
85
85
|
when 'string' then Proc.new {|val| val }
|
86
|
-
when 'timestamp' then Proc.new {|val| strptime_with_zone(val, timestamp_format, zone_offset) }
|
86
|
+
when 'timestamp' then Proc.new {|val| val ? strptime_with_zone(val, timestamp_format, zone_offset) : nil }
|
87
87
|
else raise NotSupportedType, "embulk-output-vertica cannot take column value_type #{value_type} for string column"
|
88
88
|
end
|
89
89
|
end
|
@@ -93,8 +93,8 @@ module Embulk
|
|
93
93
|
when 'boolean' then Proc.new {|val| !!val }
|
94
94
|
when 'long' then Proc.new {|val| val.to_i }
|
95
95
|
when 'double' then Proc.new {|val| val.to_f }
|
96
|
-
when 'string' then Proc.new {|val| val.localtime(zone_offset).strftime(timestamp_format) }
|
97
|
-
when 'timestamp' then Proc.new {|val| val.localtime(zone_offset) }
|
96
|
+
when 'string' then Proc.new {|val| val ? val.localtime(zone_offset).strftime(timestamp_format) : nil }
|
97
|
+
when 'timestamp' then Proc.new {|val| val ? val.localtime(zone_offset) : nil }
|
98
98
|
else raise NotSupportedType, "embulk-output-vertica cannot take column value_type #{value_type} for timesatmp column"
|
99
99
|
end
|
100
100
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: embulk-output-vertica
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- eiji.sekiya
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jvertica
|