Class: ArrowFormat::DecimalArray
- Inherits:
-
FixedSizeBinaryArray
- Object
- Array
- FixedSizeBinaryArray
- ArrowFormat::DecimalArray
- Defined in:
- lib/arrow-format/array.rb
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Array
#offset, #size, #type, #validity_buffer
Instance Method Summary collapse
Methods inherited from FixedSizeBinaryArray
Methods inherited from Array
#empty?, #initialize, #n_nulls, #null?, #slice, #valid?
Constructor Details
This class inherits a constructor from ArrowFormat::FixedSizeBinaryArray
Instance Method Details
#to_a ⇒ Object
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 |
# File 'lib/arrow-format/array.rb', line 501 def to_a return [] if empty? byte_width = @type.byte_width buffer_types = [:u64] * (byte_width / 8 - 1) + [:s64] base_offset = byte_width * @offset values = 0.step(@size * byte_width - 1, byte_width).collect do |offset| @values_buffer.get_values(buffer_types, base_offset + offset) end apply_validity(values).collect do |value| if value.nil? nil else BigDecimal(format_value(value)) end end end |