Class: Arrow::ChunkedArray
Instance Method Summary
collapse
included, #take_generic
#filter_generic, included
Instance Method Details
#[](i) ⇒ Object
50
51
52
53
54
55
56
57
|
# File 'lib/arrow/chunked-array.rb', line 50
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
30
31
32
|
# File 'lib/arrow/chunked-array.rb', line 30
def chunks
@chunks ||= chunks_raw
end
|
#chunks_raw ⇒ Object
29
|
# File 'lib/arrow/chunked-array.rb', line 29
alias_method :chunks_raw, :chunks
|
#each(&block) ⇒ Object
59
60
61
62
63
64
65
|
# File 'lib/arrow/chunked-array.rb', line 59
def each(&block)
return to_enum(__method__) unless block_given?
chunks.each do |array|
array.each(&block)
end
end
|
#each_chunk(&block) ⇒ Object
75
76
77
|
# File 'lib/arrow/chunked-array.rb', line 75
def each_chunk(&block)
chunks.each(&block)
end
|
#null?(i) ⇒ Boolean
34
35
36
37
38
39
40
|
# File 'lib/arrow/chunked-array.rb', line 34
def null?(i)
chunks.each do |array|
return array.null?(i) if i < array.length
i -= array.length
end
nil
end
|
#pack ⇒ Object
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/arrow/chunked-array.rb', line 79
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
67
68
69
70
71
72
73
|
# File 'lib/arrow/chunked-array.rb', line 67
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
42
43
44
45
46
47
48
|
# File 'lib/arrow/chunked-array.rb', line 42
def valid?(i)
chunks.each do |array|
return array.valid?(i) if i < array.length
i -= array.length
end
nil
end
|