Sha256: 136d716ff5cf804398daf002aa045a10141ecf37c09436646ba6f171d5b3948f

Contents?: true

Size: 317 Bytes

Versions: 2

Compression:

Stored size: 317 Bytes

Contents

require 'avro'
require 'json'

schema = Avro::Schema.parse(File.read(ARGV[0]))
file = File.open(ARGV[1], 'wb')
writer = Avro::IO::DatumWriter.new(schema)
dw = Avro::DataFile::Writer.new(file, writer, schema)

data = File.read(ARGV[2]).each_line.map do |l|
  JSON.load(l)
end

data.each do |d|
  dw << d
end

dw.close

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
embulk-parser-avro-0.4.0 src/test/resources/org/embulk/parser/avro/data_creator.rb
embulk-parser-avro-0.3.0 src/test/resources/org/embulk/parser/avro/data_creator.rb