red-arrow 0.8.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/Gemfile +14 -11
- data/{doc/text/apache-2.0.txt → LICENSE.txt} +0 -0
- data/NOTICE.txt +2 -0
- data/README.md +27 -30
- data/Rakefile +15 -21
- data/dependency-check/Rakefile +15 -12
- data/doc/text/development.md +19 -0
- data/lib/arrow.rb +14 -11
- data/lib/arrow/array-builder.rb +55 -55
- data/lib/arrow/array.rb +15 -11
- data/lib/arrow/block-closable.rb +14 -11
- data/lib/arrow/chunked-array.rb +15 -11
- data/lib/arrow/column.rb +14 -11
- data/lib/arrow/csv-loader.rb +49 -20
- data/lib/arrow/csv-reader.rb +14 -11
- data/lib/arrow/date32-array-builder.rb +14 -11
- data/lib/arrow/date32-array.rb +14 -11
- data/lib/arrow/date64-array-builder.rb +15 -12
- data/lib/arrow/date64-array.rb +14 -11
- data/lib/arrow/field.rb +14 -11
- data/lib/arrow/group.rb +55 -13
- data/lib/arrow/loader.rb +16 -15
- data/lib/arrow/record-batch-file-reader.rb +14 -11
- data/lib/arrow/record-batch-stream-reader.rb +14 -11
- data/lib/arrow/record-batch.rb +14 -11
- data/lib/arrow/record-containable.rb +14 -11
- data/lib/arrow/record.rb +14 -11
- data/lib/arrow/rolling-window.rb +48 -0
- data/lib/arrow/slicer.rb +20 -14
- data/lib/arrow/struct-array.rb +24 -0
- data/lib/arrow/table-formatter.rb +15 -11
- data/lib/arrow/table-list-formatter.rb +15 -11
- data/lib/arrow/table-loader.rb +24 -11
- data/lib/arrow/table-saver.rb +14 -11
- data/lib/arrow/table-table-formatter.rb +15 -11
- data/lib/arrow/table.rb +48 -17
- data/lib/arrow/tensor.rb +14 -11
- data/lib/arrow/timestamp-array-builder.rb +16 -29
- data/lib/arrow/timestamp-array.rb +15 -30
- data/lib/arrow/version.rb +23 -12
- data/red-arrow.gemspec +30 -30
- data/test/fixture/TestOrcFile.test1.orc +0 -0
- data/test/fixture/float-integer.csv +20 -0
- data/test/fixture/integer-float.csv +20 -0
- data/test/fixture/null-with-double-quote.csv +16 -0
- data/test/fixture/null-without-double-quote.csv +16 -0
- data/test/fixture/with-header-float.csv +20 -0
- data/test/fixture/with-header.csv +16 -0
- data/test/fixture/without-header-float.csv +19 -0
- data/test/fixture/without-header.csv +16 -0
- data/test/helper.rb +16 -11
- data/test/helper/fixture.rb +14 -11
- data/test/run-test.rb +17 -12
- data/test/test-array-builder.rb +14 -11
- data/test/test-array.rb +14 -11
- data/test/test-chunked-array.rb +14 -11
- data/test/test-column.rb +14 -11
- data/test/test-csv-loader.rb +68 -49
- data/test/test-csv-reader.rb +17 -12
- data/test/test-date32-array.rb +14 -11
- data/test/test-date64-array.rb +14 -11
- data/test/test-group.rb +56 -11
- data/test/test-orc.rb +177 -0
- data/test/test-record-batch-file-reader.rb +14 -11
- data/test/test-record-batch.rb +14 -11
- data/test/test-rolling-window.rb +40 -0
- data/test/test-slicer.rb +14 -11
- data/test/test-struct-array.rb +36 -0
- data/test/test-table.rb +50 -22
- data/test/test-timestamp-array.rb +14 -11
- metadata +42 -57
- data/.yardopts +0 -6
- data/doc/text/news.md +0 -176
- data/lib/arrow/buffer.rb +0 -24
- data/lib/arrow/compatibility.rb +0 -28
- data/lib/arrow/data-type.rb +0 -81
data/lib/arrow/block-closable.rb
CHANGED
@@ -1,16 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
2
8
|
#
|
3
|
-
#
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
10
|
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# limitations under the License.
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
14
17
|
|
15
18
|
module Arrow
|
16
19
|
module BlockClosable
|
data/lib/arrow/chunked-array.rb
CHANGED
@@ -1,16 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
2
8
|
#
|
3
|
-
#
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
10
|
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# limitations under the License.
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
14
17
|
|
15
18
|
module Arrow
|
16
19
|
class ChunkedArray
|
@@ -38,6 +41,7 @@ module Arrow
|
|
38
41
|
end
|
39
42
|
|
40
43
|
def [](i)
|
44
|
+
i += length if i < 0
|
41
45
|
chunks.each do |array|
|
42
46
|
return array[i] if i < array.length
|
43
47
|
i -= array.length
|
data/lib/arrow/column.rb
CHANGED
@@ -1,16 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
2
8
|
#
|
3
|
-
#
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
10
|
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# limitations under the License.
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
14
17
|
|
15
18
|
module Arrow
|
16
19
|
class Column
|
data/lib/arrow/csv-loader.rb
CHANGED
@@ -1,16 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
2
8
|
#
|
3
|
-
#
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
10
|
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# limitations under the License.
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
14
17
|
|
15
18
|
require "csv"
|
16
19
|
require "pathname"
|
@@ -117,20 +120,32 @@ module Arrow
|
|
117
120
|
end
|
118
121
|
|
119
122
|
def update_csv_parse_options(options, create_csv, *args)
|
120
|
-
|
123
|
+
if options.key?(:converters)
|
124
|
+
new_options = options.dup
|
125
|
+
else
|
126
|
+
converters = [:all, BOOLEAN_CONVERTER, ISO8601_CONVERTER]
|
127
|
+
new_options = options.merge(converters: converters)
|
128
|
+
end
|
121
129
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
130
|
+
unless options.key?(:headers)
|
131
|
+
__send__(create_csv, *args, **new_options) do |csv|
|
132
|
+
new_options[:headers] = have_header?(csv)
|
133
|
+
end
|
126
134
|
end
|
127
|
-
|
128
|
-
new_options
|
135
|
+
unless options.key?(:converters)
|
136
|
+
__send__(create_csv, *args, **new_options) do |csv|
|
137
|
+
new_options[:converters] = detect_robust_converters(csv)
|
138
|
+
end
|
129
139
|
end
|
130
|
-
|
140
|
+
|
141
|
+
new_options
|
131
142
|
end
|
132
143
|
|
133
144
|
def have_header?(csv)
|
145
|
+
if @options.key?(:headers)
|
146
|
+
return @options[:headers]
|
147
|
+
end
|
148
|
+
|
134
149
|
row1 = csv.shift
|
135
150
|
return false if row1.nil?
|
136
151
|
return false if row1.any?(&:nil?)
|
@@ -139,6 +154,8 @@ module Arrow
|
|
139
154
|
return nil if row2.nil?
|
140
155
|
return true if row2.any?(&:nil?)
|
141
156
|
|
157
|
+
return false if row1.any? {|value| not value.is_a?(String)}
|
158
|
+
|
142
159
|
if row1.collect(&:class) != row2.collect(&:class)
|
143
160
|
return true
|
144
161
|
end
|
@@ -149,7 +166,16 @@ module Arrow
|
|
149
166
|
def detect_robust_converters(csv)
|
150
167
|
column_types = []
|
151
168
|
csv.each do |row|
|
152
|
-
row.
|
169
|
+
if row.is_a?(CSV::Row)
|
170
|
+
each_value = Enumerator.new do |yielder|
|
171
|
+
row.each do |_name, value|
|
172
|
+
yielder << value
|
173
|
+
end
|
174
|
+
end
|
175
|
+
else
|
176
|
+
each_value = row.each
|
177
|
+
end
|
178
|
+
each_value.with_index do |value, i|
|
153
179
|
current_column_type = column_types[i]
|
154
180
|
next if current_column_type == :string
|
155
181
|
|
@@ -161,6 +187,9 @@ module Arrow
|
|
161
187
|
candidate_type = :boolean
|
162
188
|
when Integer
|
163
189
|
candidate_type = :integer
|
190
|
+
if current_column_type == :float
|
191
|
+
candidate_type = :float
|
192
|
+
end
|
164
193
|
when Float
|
165
194
|
candidate_type = :float
|
166
195
|
if current_column_type == :integer
|
data/lib/arrow/csv-reader.rb
CHANGED
@@ -1,16 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
2
8
|
#
|
3
|
-
#
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
10
|
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# limitations under the License.
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
14
17
|
|
15
18
|
require "csv"
|
16
19
|
|
@@ -1,16 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
2
8
|
#
|
3
|
-
#
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
10
|
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# limitations under the License.
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
14
17
|
|
15
18
|
module Arrow
|
16
19
|
class Date32ArrayBuilder
|
data/lib/arrow/date32-array.rb
CHANGED
@@ -1,16 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
2
8
|
#
|
3
|
-
#
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
10
|
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# limitations under the License.
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
14
17
|
|
15
18
|
module Arrow
|
16
19
|
class Date32Array
|
@@ -1,16 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
2
8
|
#
|
3
|
-
#
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
10
|
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# limitations under the License.
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
14
17
|
|
15
18
|
module Arrow
|
16
19
|
class Date64ArrayBuilder
|
@@ -21,7 +24,7 @@ module Arrow
|
|
21
24
|
end
|
22
25
|
|
23
26
|
if value.is_a?(Time)
|
24
|
-
value.to_i * 1_000 + value.usec /
|
27
|
+
value.to_i * 1_000 + value.usec / 1_000
|
25
28
|
else
|
26
29
|
value
|
27
30
|
end
|
data/lib/arrow/date64-array.rb
CHANGED
@@ -1,16 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
2
8
|
#
|
3
|
-
#
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
10
|
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# limitations under the License.
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
14
17
|
|
15
18
|
module Arrow
|
16
19
|
class Date64Array
|
data/lib/arrow/field.rb
CHANGED
@@ -1,16 +1,19 @@
|
|
1
|
-
#
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
2
8
|
#
|
3
|
-
#
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
10
|
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# limitations under the License.
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
14
17
|
|
15
18
|
module Arrow
|
16
19
|
class Field
|
data/lib/arrow/group.rb
CHANGED
@@ -1,18 +1,24 @@
|
|
1
|
-
#
|
1
|
+
# Licensed to the Apache Software Foundation (ASF) under one
|
2
|
+
# or more contributor license agreements. See the NOTICE file
|
3
|
+
# distributed with this work for additional information
|
4
|
+
# regarding copyright ownership. The ASF licenses this file
|
5
|
+
# to you under the Apache License, Version 2.0 (the
|
6
|
+
# "License"); you may not use this file except in compliance
|
7
|
+
# with the License. You may obtain a copy of the License at
|
2
8
|
#
|
3
|
-
#
|
4
|
-
# you may not use this file except in compliance with the License.
|
5
|
-
# You may obtain a copy of the License at
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
6
10
|
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
# limitations under the License.
|
11
|
+
# Unless required by applicable law or agreed to in writing,
|
12
|
+
# software distributed under the License is distributed on an
|
13
|
+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
14
|
+
# KIND, either express or implied. See the License for the
|
15
|
+
# specific language governing permissions and limitations
|
16
|
+
# under the License.
|
14
17
|
|
15
18
|
module Arrow
|
19
|
+
# Experimental
|
20
|
+
#
|
21
|
+
# TODO: Almost codes should be implemented in Apache Arrow C++.
|
16
22
|
class Group
|
17
23
|
def initialize(table, keys)
|
18
24
|
@table = table
|
@@ -37,7 +43,7 @@ module Arrow
|
|
37
43
|
key_names = @keys.collect(&:to_s)
|
38
44
|
target_columns = @table.columns.reject do |column|
|
39
45
|
key_names.include?(column.name) or
|
40
|
-
not column.data_type.
|
46
|
+
not column.data_type.is_a?(NumericDataType)
|
41
47
|
end
|
42
48
|
aggregate(target_columns) do |column, indexes|
|
43
49
|
n = 0
|
@@ -53,7 +59,7 @@ module Arrow
|
|
53
59
|
key_names = @keys.collect(&:to_s)
|
54
60
|
target_columns = @table.columns.reject do |column|
|
55
61
|
key_names.include?(column.name) or
|
56
|
-
not column.data_type.
|
62
|
+
not column.data_type.is_a?(NumericDataType)
|
57
63
|
end
|
58
64
|
aggregate(target_columns) do |column, indexes|
|
59
65
|
average = 0.0
|
@@ -69,6 +75,42 @@ module Arrow
|
|
69
75
|
end
|
70
76
|
end
|
71
77
|
|
78
|
+
def min
|
79
|
+
key_names = @keys.collect(&:to_s)
|
80
|
+
target_columns = @table.columns.reject do |column|
|
81
|
+
key_names.include?(column.name) or
|
82
|
+
not column.data_type.is_a?(NumericDataType)
|
83
|
+
end
|
84
|
+
aggregate(target_columns) do |column, indexes|
|
85
|
+
n = nil
|
86
|
+
indexes.each do |index|
|
87
|
+
value = column[index]
|
88
|
+
next if value.nil?
|
89
|
+
n ||= value
|
90
|
+
n = value if value < n
|
91
|
+
end
|
92
|
+
n
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def max
|
97
|
+
key_names = @keys.collect(&:to_s)
|
98
|
+
target_columns = @table.columns.reject do |column|
|
99
|
+
key_names.include?(column.name) or
|
100
|
+
not column.data_type.is_a?(NumericDataType)
|
101
|
+
end
|
102
|
+
aggregate(target_columns) do |column, indexes|
|
103
|
+
n = nil
|
104
|
+
indexes.each do |index|
|
105
|
+
value = column[index]
|
106
|
+
next if value.nil?
|
107
|
+
n ||= value
|
108
|
+
n = value if value > n
|
109
|
+
end
|
110
|
+
n
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
72
114
|
private
|
73
115
|
def aggregate(target_columns)
|
74
116
|
sort_values = @table.n_rows.times.collect do |i|
|