Class: ArrowFormat::StructArray
- Defined in:
- lib/arrow-format/array.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
Attributes inherited from Array
#offset, #size, #type, #validity_buffer
Instance Method Summary collapse
- #each_buffer {|slice_bitmap_buffer(:validity, @validity_buffer)| ... } ⇒ Object
-
#initialize(type, size, validity_buffer, children) ⇒ StructArray
constructor
A new instance of StructArray.
- #to_a ⇒ Object
Methods inherited from Array
#empty?, #n_nulls, #null?, #slice, #valid?
Constructor Details
#initialize(type, size, validity_buffer, children) ⇒ StructArray
Returns a new instance of StructArray.
643 644 645 646 |
# File 'lib/arrow-format/array.rb', line 643 def initialize(type, size, validity_buffer, children) super(type, size, validity_buffer) @children = children end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
642 643 644 |
# File 'lib/arrow-format/array.rb', line 642 def children @children end |
Instance Method Details
#each_buffer {|slice_bitmap_buffer(:validity, @validity_buffer)| ... } ⇒ Object
648 649 650 651 652 |
# File 'lib/arrow-format/array.rb', line 648 def each_buffer(&block) return to_enum(__method__) unless block_given? yield(slice_bitmap_buffer(:validity, @validity_buffer)) end |
#to_a ⇒ Object
654 655 656 657 658 659 660 661 662 663 664 |
# File 'lib/arrow-format/array.rb', line 654 def to_a return [] if empty? if @children.empty? values = [[]] * @size else children_values = @children.collect(&:to_a) values = children_values[0].zip(*children_values[1..-1]) end apply_validity(values) end |