Skip to content

Commit 3deea09

Browse files
committed
Support JSON type
Signed-off-by: Takahiro Nakayama <civitaspo@gmail.com>
1 parent 3c9d1cd commit 3deea09

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/embulk/output/bigquery/value_converter_factory.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,10 @@ def json_converter
288288
Proc.new {|val|
289289
val
290290
}
291+
when 'JSON'
292+
Proc.new {|val|
293+
val
294+
}
291295
else
292296
raise NotSupportedType, "cannot take column type #{type} for json column"
293297
end

test/test_value_converter_factory.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,12 @@ def test_record
389389
assert_equal nil, converter.call(nil)
390390
assert_equal({'foo'=>'foo'}, converter.call({'foo'=>'foo'}))
391391
end
392+
393+
def test_json
394+
converter = ValueConverterFactory.new(SCHEMA_TYPE, 'JSON').create_converter
395+
assert_equal nil, converter.call(nil)
396+
assert_equal({'foo'=>'foo'}, converter.call({'foo'=>'foo'}))
397+
end
392398
end
393399

394400
def test_strict_false

0 commit comments

Comments
 (0)