Skip to content

Commit 8fd7b4e

Browse files
committed
fix: timezone setting for TIME type
1 parent 8eaab04 commit 8fd7b4e

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

lib/embulk/output/bigquery/value_converter_factory.rb

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,12 +225,19 @@ def string_converter
225225
}
226226
end
227227
when 'TIME'
228-
Proc.new {|val|
229-
next nil if val.nil?
230-
with_typecast_error(val) do |val|
228+
if @timestamp_format
229+
Proc.new {|val|
230+
next nil if val.nil?
231+
with_typecast_error(val) do |val|
232+
Time.strptime(val, @timestamp_format).strftime("%H:%M:%S.%6N")
233+
end
234+
}
235+
else
236+
Proc.new {|val|
237+
next nil if val.nil?
231238
Time.parse(val).strftime("%H:%M:%S.%6N")
232-
end
233-
}
239+
}
240+
end
234241
when 'RECORD'
235242
Proc.new {|val|
236243
next nil if val.nil?

0 commit comments

Comments
 (0)