Class: Arrow::ChunkedArray
Instance Method Summary
collapse
included, #take_generic
#filter_generic, included
#max, #min, #uniq
Instance Method Details
#[](i) ⇒ Object
52
53
54
55
56
57
58
59
|
# File 'lib/arrow/chunked-array.rb', line 52
def [](i)
i += length if i < 0
chunks.each do |array|
return array[i] if i < array.length
i -= array.length
end
nil
end
|
#cast(target_data_type, options: nil) ⇒ Object
105
106
107
108
109
110
|
# File 'lib/arrow/chunked-array.rb', line 105
def cast(target_data_type, options: nil)
casted_chunks = chunks.collect do |chunk|
chunk.cast(target_data_type, options)
end
self.class.new(casted_chunks)
end
|
#chunks ⇒ Object
32
33
34
|
# File 'lib/arrow/chunked-array.rb', line 32
def chunks
@chunks ||= chunks_raw
end
|
#chunks_raw ⇒ Object
31
|
# File 'lib/arrow/chunked-array.rb', line 31
alias_method :chunks_raw, :chunks
|
#count(options: nil) ⇒ Object
93
94
95
|
# File 'lib/arrow/chunked-array.rb', line 93
def count(options: nil)
compute("count", options: options).value
end
|
#each(&block) ⇒ Object
61
62
63
64
65
66
67
|
# File 'lib/arrow/chunked-array.rb', line 61
def each(&block)
return to_enum(__method__) unless block_given?
chunks.each do |array|
array.each(&block)
end
end
|
#each_chunk(&block) ⇒ Object
77
78
79
|
# File 'lib/arrow/chunked-array.rb', line 77
def each_chunk(&block)
chunks.each(&block)
end
|
#null?(i) ⇒ Boolean
36
37
38
39
40
41
42
|
# File 'lib/arrow/chunked-array.rb', line 36
def null?(i)
chunks.each do |array|
return array.null?(i) if i < array.length
i -= array.length
end
nil
end
|
#pack ⇒ Object
81
82
83
84
85
86
87
88
89
90
91
|
# File 'lib/arrow/chunked-array.rb', line 81
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
69
70
71
72
73
74
75
|
# File 'lib/arrow/chunked-array.rb', line 69
def reverse_each(&block)
return to_enum(__method__) unless block_given?
chunks.reverse_each do |array|
array.reverse_each(&block)
end
end
|
#sum(options: nil) ⇒ Object
97
98
99
|
# File 'lib/arrow/chunked-array.rb', line 97
def sum(options: nil)
compute("sum", options: options).value
end
|
#unique ⇒ Object
101
102
103
|
# File 'lib/arrow/chunked-array.rb', line 101
def unique
compute("unique")
end
|
#valid?(i) ⇒ Boolean
44
45
46
47
48
49
50
|
# File 'lib/arrow/chunked-array.rb', line 44
def valid?(i)
chunks.each do |array|
return array.valid?(i) if i < array.length
i -= array.length
end
nil
end
|