Class: ArrowFormat::MonthDayNanoIntervalArray

Inherits:
IntervalArray show all
Defined in:
lib/arrow-format/array.rb

Instance Attribute Summary

Attributes inherited from Array

#offset, #size, #type, #validity_buffer

Instance Method Summary collapse

Methods inherited from PrimitiveArray

#each_buffer, #initialize

Methods inherited from Array

#empty?, #initialize, #n_nulls, #null?, #slice, #valid?

Constructor Details

This class inherits a constructor from ArrowFormat::PrimitiveArray

Instance Method Details

#to_aObject



371
372
373
374
375
376
377
378
379
380
381
382
# File 'lib/arrow-format/array.rb', line 371

def to_a
  return [] if empty?

  buffer_types = @type.buffer_types
  value_size = IO::Buffer.size_of(buffer_types)
  base_offset = value_size * @offset
  values = @size.times.collect do |i|
    offset = base_offset + value_size * i
    @values_buffer.get_values(buffer_types, offset)
  end
  apply_validity(values)
end