Class: ArrowFormat::FixedSizeBinaryArray

Inherits:
Array
  • Object
show all
Defined in:
lib/arrow-format/array.rb

Direct Known Subclasses

DecimalArray

Instance Attribute Summary

Attributes inherited from Array

#offset, #size, #type, #validity_buffer

Instance Method Summary collapse

Methods inherited from Array

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

Constructor Details

#initialize(type, size, validity_buffer, values_buffer) ⇒ FixedSizeBinaryArray

Returns a new instance of FixedSizeBinaryArray.



475
476
477
478
# File 'lib/arrow-format/array.rb', line 475

def initialize(type, size, validity_buffer, values_buffer)
  super(type, size, validity_buffer)
  @values_buffer = values_buffer
end

Instance Method Details

#each_buffer {|slice_bitmap_buffer(:validity, @validity_buffer)| ... } ⇒ Object

Yields:



480
481
482
483
484
485
486
487
# File 'lib/arrow-format/array.rb', line 480

def each_buffer
  return to_enum(__method__) unless block_given?

  yield(slice_bitmap_buffer(:validity, @validity_buffer))
  yield(slice_fixed_element_size_buffer(:values,
                                        @values_buffer,
                                        @type.byte_width))
end

#to_aObject



489
490
491
492
493
494
495
496
497
# File 'lib/arrow-format/array.rb', line 489

def to_a
  return [] if empty?

  byte_width = @type.byte_width
  values = 0.step(@size * byte_width - 1, byte_width).collect do |offset|
    @values_buffer.get_string(offset, byte_width)
  end
  apply_validity(values)
end