Sha256: 192bc7da1e44c4ee4b419b8f5e1495458b0330f099e6a481d46fb68a1a0c6898

Contents?: true

Size: 574 Bytes

Versions: 1

Compression:

Stored size: 574 Bytes

Contents

#!/usr/bin/env ruby

require "gi"

Arrow = GI.load("Arrow")
ArrowIO = GI.load("ArrowIO")
ArrowIPC = GI.load("ArrowIPC")

module Arrow
  class Array
    def [](i)
      get_value(i)
    end

    include Enumerable
    def each
      length.times do |i|
        yield(self[i])
      end
    end
  end
end

file = ArrowIO::MemoryMappedFile.open("/tmp/xxx", :read)
reader = ArrowIPC::FileReader.open(file)
p reader.schema.fields.collect(&:name)
record_batch = reader.get_record_batch(0)
record_batch.n_rows.times do |i|
  p record_batch.columns.collect {|column| column[i]}
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rabbit-slide-kou-nagoya-rubykaigi-03-2017.2.11.0 examples/read.rb