Class: Arrow::ChunkedArray
- Inherits:
-
Object
- Object
- Arrow::ChunkedArray
- Includes:
- Enumerable
- Defined in:
- lib/arrow/chunked-array.rb
Instance Method Summary collapse
- #[](i) ⇒ Object
- #chunks ⇒ Object
- #chunks_raw ⇒ Object
- #each(&block) ⇒ Object
- #each_chunk(&block) ⇒ Object
- #null?(i) ⇒ Boolean
- #pack ⇒ Object
- #reverse_each(&block) ⇒ Object
- #valid?(i) ⇒ Boolean
Instance Method Details
#[](i) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/arrow/chunked-array.rb', line 48 def [](i) i += length if i < 0 chunks.each do |array| return array[i] if i < array.length i -= array.length end nil end |
#chunks ⇒ Object
28 29 30 |
# File 'lib/arrow/chunked-array.rb', line 28 def chunks @chunks ||= chunks_raw end |
#chunks_raw ⇒ Object
27 |
# File 'lib/arrow/chunked-array.rb', line 27 alias_method :chunks_raw, :chunks |
#each(&block) ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/arrow/chunked-array.rb', line 57 def each(&block) return to_enum(__method__) unless block_given? chunks.each do |array| array.each(&block) end end |
#each_chunk(&block) ⇒ Object
73 74 75 |
# File 'lib/arrow/chunked-array.rb', line 73 def each_chunk(&block) chunks.each(&block) end |
#null?(i) ⇒ Boolean
32 33 34 35 36 37 38 |
# File 'lib/arrow/chunked-array.rb', line 32 def null?(i) chunks.each do |array| return array.null?(i) if i < array.length i -= array.length end nil end |
#pack ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/arrow/chunked-array.rb', line 77 def pack first_chunk = chunks.first data_type = first_chunk.value_data_type case data_type when TimestampDataType builder = TimestampArrayBuilder.new(data_type) builder.build(to_a) else first_chunk.class.new(to_a) end end |
#reverse_each(&block) ⇒ Object
65 66 67 68 69 70 71 |
# File 'lib/arrow/chunked-array.rb', line 65 def reverse_each(&block) return to_enum(__method__) unless block_given? chunks.reverse_each do |array| array.reverse_each(&block) end end |
#valid?(i) ⇒ Boolean
40 41 42 43 44 45 46 |
# File 'lib/arrow/chunked-array.rb', line 40 def valid?(i) chunks.each do |array| return array.valid?(i) if i < array.length i -= array.length end nil end |