Class: ArrowFormat::SparseUnionArray

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

Instance Attribute Summary

Attributes inherited from UnionArray

#children, #types_buffer

Attributes inherited from Array

#offset, #size, #type, #validity_buffer

Instance Method Summary collapse

Methods inherited from UnionArray

#each_type, #initialize

Methods inherited from Array

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

Constructor Details

This class inherits a constructor from ArrowFormat::UnionArray

Instance Method Details

#each_buffer {|slice_fixed_element_size_buffer(:types, @types_buffer, type_element_size)| ... } ⇒ Object

Yields:

  • (slice_fixed_element_size_buffer(:types, @types_buffer, type_element_size))


775
776
777
778
779
780
781
# File 'lib/arrow-format/array.rb', line 775

def each_buffer(&block)
  return to_enum(__method__) unless block_given?

  yield(slice_fixed_element_size_buffer(:types,
                                        @types_buffer,
                                        type_element_size))
end

#to_aObject



783
784
785
786
787
788
789
790
791
# File 'lib/arrow-format/array.rb', line 783

def to_a
  return [] if empty?

  children_values = @children.collect(&:to_a)
  each_type.with_index.collect do |type, i|
    index = @type.resolve_type_index(type)
    children_values[index][i]
  end
end