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
43 44 45 46 47 48 49 50 |
# File 'lib/arrow/chunked-array.rb', line 43 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
23 24 25 |
# File 'lib/arrow/chunked-array.rb', line 23 def chunks @chunks ||= chunks_raw end |
#chunks_raw ⇒ Object
22 |
# File 'lib/arrow/chunked-array.rb', line 22 alias_method :chunks_raw, :chunks |
#each(&block) ⇒ Object
52 53 54 55 56 57 58 |
# File 'lib/arrow/chunked-array.rb', line 52 def each(&block) return to_enum(__method__) unless block_given? chunks.each do |array| array.each(&block) end end |
#each_chunk(&block) ⇒ Object
68 69 70 |
# File 'lib/arrow/chunked-array.rb', line 68 def each_chunk(&block) chunks.each(&block) end |
#null?(i) ⇒ Boolean
27 28 29 30 31 32 33 |
# File 'lib/arrow/chunked-array.rb', line 27 def null?(i) chunks.each do |array| return array.null?(i) if i < array.length i -= array.length end nil end |
#pack ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/arrow/chunked-array.rb', line 72 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
60 61 62 63 64 65 66 |
# File 'lib/arrow/chunked-array.rb', line 60 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
35 36 37 38 39 40 41 |
# File 'lib/arrow/chunked-array.rb', line 35 def valid?(i) chunks.each do |array| return array.valid?(i) if i < array.length i -= array.length end nil end |