Class: ArrowFormat::Array
- Inherits:
-
Object
- Object
- ArrowFormat::Array
- Defined in:
- lib/arrow-format/array.rb
Direct Known Subclasses
DictionaryArray, FixedSizeBinaryArray, FixedSizeListArray, NullArray, PrimitiveArray, StructArray, UnionArray, VariableSizeBinaryArray, VariableSizeListArray
Instance Attribute Summary collapse
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#size ⇒ Object
(also: #length)
readonly
Returns the value of attribute size.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#validity_buffer ⇒ Object
readonly
Returns the value of attribute validity_buffer.
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize(type, size, validity_buffer) ⇒ Array
constructor
A new instance of Array.
- #n_nulls ⇒ Object
- #null?(i) ⇒ Boolean
- #slice(offset, size = nil) ⇒ Object
- #valid?(i) ⇒ Boolean
Constructor Details
#initialize(type, size, validity_buffer) ⇒ Array
Returns a new instance of Array.
28 29 30 31 32 33 34 |
# File 'lib/arrow-format/array.rb', line 28 def initialize(type, size, validity_buffer) @type = type @size = size @offset = 0 @validity_buffer = validity_buffer @sliced_buffers = {} end |
Instance Attribute Details
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
26 27 28 |
# File 'lib/arrow-format/array.rb', line 26 def offset @offset end |
#size ⇒ Object (readonly) Also known as: length
Returns the value of attribute size.
24 25 26 |
# File 'lib/arrow-format/array.rb', line 24 def size @size end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
23 24 25 |
# File 'lib/arrow-format/array.rb', line 23 def type @type end |
#validity_buffer ⇒ Object (readonly)
Returns the value of attribute validity_buffer.
27 28 29 |
# File 'lib/arrow-format/array.rb', line 27 def validity_buffer @validity_buffer end |
Instance Method Details
#empty? ⇒ Boolean
59 60 61 |
# File 'lib/arrow-format/array.rb', line 59 def empty? @size.zero? end |
#n_nulls ⇒ Object
51 52 53 54 55 56 57 |
# File 'lib/arrow-format/array.rb', line 51 def n_nulls if @validity_buffer.nil? 0 else @size - validity_bitmap.popcount end end |
#null?(i) ⇒ Boolean
47 48 49 |
# File 'lib/arrow-format/array.rb', line 47 def null?(i) not valid?(i) end |
#slice(offset, size = nil) ⇒ Object
36 37 38 39 40 |
# File 'lib/arrow-format/array.rb', line 36 def slice(offset, size=nil) sliced = dup sliced.slice!(@offset + offset, size || @size - offset) sliced end |
#valid?(i) ⇒ Boolean
42 43 44 45 |
# File 'lib/arrow-format/array.rb', line 42 def valid?(i) return true if @validity_buffer.nil? validity_bitmap[i] end |