Class: ArrowFormat::UnionArray

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

Direct Known Subclasses

DenseUnionArray, SparseUnionArray

Instance Attribute Summary collapse

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, types_buffer, children) ⇒ UnionArray

Returns a new instance of UnionArray.



696
697
698
699
700
# File 'lib/arrow-format/array.rb', line 696

def initialize(type, size, types_buffer, children)
  super(type, size, nil)
  @types_buffer = types_buffer
  @children = children
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



695
696
697
# File 'lib/arrow-format/array.rb', line 695

def children
  @children
end

#types_bufferObject (readonly)

Returns the value of attribute types_buffer.



694
695
696
# File 'lib/arrow-format/array.rb', line 694

def types_buffer
  @types_buffer
end

Instance Method Details

#each_type(&block) ⇒ Object



702
703
704
705
706
707
708
709
710
711
712
# File 'lib/arrow-format/array.rb', line 702

def each_type(&block)
  return [].each(&block) if empty?

  return to_enum(__method__) unless block_given?

  @types_buffer.each(type_buffer_type,
                     type_element_size * @offset,
                     @size) do |_, type|
    yield(type)
  end
end