red-arrow 0.8.2 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +14 -11
  3. data/{doc/text/apache-2.0.txt → LICENSE.txt} +0 -0
  4. data/NOTICE.txt +2 -0
  5. data/README.md +27 -30
  6. data/Rakefile +15 -21
  7. data/dependency-check/Rakefile +15 -12
  8. data/doc/text/development.md +19 -0
  9. data/lib/arrow.rb +14 -11
  10. data/lib/arrow/array-builder.rb +55 -55
  11. data/lib/arrow/array.rb +15 -11
  12. data/lib/arrow/block-closable.rb +14 -11
  13. data/lib/arrow/chunked-array.rb +15 -11
  14. data/lib/arrow/column.rb +14 -11
  15. data/lib/arrow/csv-loader.rb +49 -20
  16. data/lib/arrow/csv-reader.rb +14 -11
  17. data/lib/arrow/date32-array-builder.rb +14 -11
  18. data/lib/arrow/date32-array.rb +14 -11
  19. data/lib/arrow/date64-array-builder.rb +15 -12
  20. data/lib/arrow/date64-array.rb +14 -11
  21. data/lib/arrow/field.rb +14 -11
  22. data/lib/arrow/group.rb +55 -13
  23. data/lib/arrow/loader.rb +16 -15
  24. data/lib/arrow/record-batch-file-reader.rb +14 -11
  25. data/lib/arrow/record-batch-stream-reader.rb +14 -11
  26. data/lib/arrow/record-batch.rb +14 -11
  27. data/lib/arrow/record-containable.rb +14 -11
  28. data/lib/arrow/record.rb +14 -11
  29. data/lib/arrow/rolling-window.rb +48 -0
  30. data/lib/arrow/slicer.rb +20 -14
  31. data/lib/arrow/struct-array.rb +24 -0
  32. data/lib/arrow/table-formatter.rb +15 -11
  33. data/lib/arrow/table-list-formatter.rb +15 -11
  34. data/lib/arrow/table-loader.rb +24 -11
  35. data/lib/arrow/table-saver.rb +14 -11
  36. data/lib/arrow/table-table-formatter.rb +15 -11
  37. data/lib/arrow/table.rb +48 -17
  38. data/lib/arrow/tensor.rb +14 -11
  39. data/lib/arrow/timestamp-array-builder.rb +16 -29
  40. data/lib/arrow/timestamp-array.rb +15 -30
  41. data/lib/arrow/version.rb +23 -12
  42. data/red-arrow.gemspec +30 -30
  43. data/test/fixture/TestOrcFile.test1.orc +0 -0
  44. data/test/fixture/float-integer.csv +20 -0
  45. data/test/fixture/integer-float.csv +20 -0
  46. data/test/fixture/null-with-double-quote.csv +16 -0
  47. data/test/fixture/null-without-double-quote.csv +16 -0
  48. data/test/fixture/with-header-float.csv +20 -0
  49. data/test/fixture/with-header.csv +16 -0
  50. data/test/fixture/without-header-float.csv +19 -0
  51. data/test/fixture/without-header.csv +16 -0
  52. data/test/helper.rb +16 -11
  53. data/test/helper/fixture.rb +14 -11
  54. data/test/run-test.rb +17 -12
  55. data/test/test-array-builder.rb +14 -11
  56. data/test/test-array.rb +14 -11
  57. data/test/test-chunked-array.rb +14 -11
  58. data/test/test-column.rb +14 -11
  59. data/test/test-csv-loader.rb +68 -49
  60. data/test/test-csv-reader.rb +17 -12
  61. data/test/test-date32-array.rb +14 -11
  62. data/test/test-date64-array.rb +14 -11
  63. data/test/test-group.rb +56 -11
  64. data/test/test-orc.rb +177 -0
  65. data/test/test-record-batch-file-reader.rb +14 -11
  66. data/test/test-record-batch.rb +14 -11
  67. data/test/test-rolling-window.rb +40 -0
  68. data/test/test-slicer.rb +14 -11
  69. data/test/test-struct-array.rb +36 -0
  70. data/test/test-table.rb +50 -22
  71. data/test/test-timestamp-array.rb +14 -11
  72. metadata +42 -57
  73. data/.yardopts +0 -6
  74. data/doc/text/news.md +0 -176
  75. data/lib/arrow/buffer.rb +0 -24
  76. data/lib/arrow/compatibility.rb +0 -28
  77. data/lib/arrow/data-type.rb +0 -81
@@ -1,16 +1,19 @@
1
- # Copyright 2017-2018 Kouhei Sutou <kou@clear-code.com>
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
- # Licensed under the Apache License, Version 2.0 (the "License");
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
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
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 "arrow/block-closable"
16
19
 
@@ -30,12 +33,10 @@ module Arrow
30
33
  def require_libraries
31
34
  require "arrow/array"
32
35
  require "arrow/array-builder"
33
- require "arrow/buffer"
34
36
  require "arrow/chunked-array"
35
37
  require "arrow/column"
36
38
  require "arrow/csv-loader"
37
39
  require "arrow/csv-reader"
38
- require "arrow/data-type"
39
40
  require "arrow/date32-array"
40
41
  require "arrow/date32-array-builder"
41
42
  require "arrow/date64-array"
@@ -43,7 +44,9 @@ module Arrow
43
44
  require "arrow/field"
44
45
  require "arrow/record"
45
46
  require "arrow/record-batch"
47
+ require "arrow/rolling-window"
46
48
  require "arrow/slicer"
49
+ require "arrow/struct-array"
47
50
  require "arrow/table"
48
51
  require "arrow/table-formatter"
49
52
  require "arrow/table-list-formatter"
@@ -56,8 +59,6 @@ module Arrow
56
59
 
57
60
  require "arrow/record-batch-file-reader"
58
61
  require "arrow/record-batch-stream-reader"
59
-
60
- require "arrow/compatibility"
61
62
  end
62
63
 
63
64
  def load_object_info(info)
@@ -1,16 +1,19 @@
1
- # Copyright 2017 Kouhei Sutou <kou@clear-code.com>
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
- # Licensed under the Apache License, Version 2.0 (the "License");
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
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
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 RecordBatchFileReader
@@ -1,16 +1,19 @@
1
- # Copyright 2017 Kouhei Sutou <kou@clear-code.com>
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
- # Licensed under the Apache License, Version 2.0 (the "License");
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
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
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 RecordBatchStreamReader
@@ -1,16 +1,19 @@
1
- # Copyright 2017 Kouhei Sutou <kou@clear-code.com>
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
- # Licensed under the Apache License, Version 2.0 (the "License");
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
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
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 "arrow/record-containable"
16
19
 
@@ -1,16 +1,19 @@
1
- # Copyright 2017-2018 Kouhei Sutou <kou@clear-code.com>
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
- # Licensed under the Apache License, Version 2.0 (the "License");
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
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
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 RecordContainable
@@ -1,16 +1,19 @@
1
- # Copyright 2017 Kouhei Sutou <kou@clear-code.com>
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
- # Licensed under the Apache License, Version 2.0 (the "License");
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
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
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 Record
@@ -0,0 +1,48 @@
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
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
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.
17
+
18
+ module Arrow
19
+ # Experimental
20
+ #
21
+ # TODO: Almost codes should be implemented in Apache Arrow C++.
22
+ class RollingWindow
23
+ def initialize(table, size)
24
+ @table = table
25
+ @size = size
26
+ end
27
+
28
+ def lag(key, diff: 1)
29
+ column = @table[key]
30
+ if @size
31
+ windows = column.each_slice(@size)
32
+ else
33
+ windows = column
34
+ end
35
+ lag_values = [nil] * diff
36
+ windows.each_cons(diff + 1) do |values|
37
+ target = values[0]
38
+ current = values[1]
39
+ if target.nil? or current.nil?
40
+ lag_values << nil
41
+ else
42
+ lag_values << current - target
43
+ end
44
+ end
45
+ ArrayBuilder.build(lag_values)
46
+ end
47
+ end
48
+ end
@@ -1,18 +1,24 @@
1
- # Copyright 2017 Kouhei Sutou <kou@clear-code.com>
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
- # Licensed under the Apache License, Version 2.0 (the "License");
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
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
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 Slicer
17
23
  def initialize(table)
18
24
  @table = table
@@ -116,10 +122,10 @@ module Arrow
116
122
  data
117
123
  else
118
124
  if data.n_chunks == 1
119
- data.get_chunk(0).cast(BooleanDataType.new)
125
+ data.get_chunk(0).cast(BooleanDataType.new, nil)
120
126
  else
121
127
  arrays = data.each_chunk.collect do |chunk|
122
- chunk.cast(BooleanDataType.new)
128
+ chunk.cast(BooleanDataType.new, nil)
123
129
  end
124
130
  ChunkedArray.new(arrays)
125
131
  end
@@ -187,7 +193,7 @@ module Arrow
187
193
  if chunk.is_a?(BooleanArray)
188
194
  boolean_array = chunk
189
195
  else
190
- boolean_array = chunk.cast(BooleanDataType.new)
196
+ boolean_array = chunk.cast(BooleanDataType.new, nil)
191
197
  end
192
198
  boolean_array.each do |value|
193
199
  if value.nil?
@@ -0,0 +1,24 @@
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
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
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.
17
+
18
+ module Arrow
19
+ class StructArray
20
+ def [](i)
21
+ get_field(i)
22
+ end
23
+ end
24
+ end
@@ -1,18 +1,22 @@
1
- # Copyright 2017-2018 Kouhei Sutou <kou@clear-code.com>
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
- # Licensed under the Apache License, Version 2.0 (the "License");
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
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
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
+ # TODO: Almost codes should be implemented in Apache Arrow C++.
16
20
  class TableFormatter
17
21
  def initialize(table, options={})
18
22
  @table = table
@@ -1,18 +1,22 @@
1
- # Copyright 2018 Kouhei Sutou <kou@clear-code.com>
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
- # Licensed under the Apache License, Version 2.0 (the "License");
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
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
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
+ # TODO: Almost codes should be implemented in Apache Arrow C++.
16
20
  class TableListFormatter < TableFormatter
17
21
  private
18
22
  def format_header(text, columns)
@@ -1,16 +1,19 @@
1
- # Copyright 2018 Kouhei Sutou <kou@clear-code.com>
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
- # Licensed under the Apache License, Version 2.0 (the "License");
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
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
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 TableLoader
@@ -108,6 +111,16 @@ module Arrow
108
111
  load_raw(input, reader)
109
112
  end
110
113
 
114
+ if Arrow.const_defined?(:ORCFileReader)
115
+ def load_as_orc(path)
116
+ input = MemoryMappedInputStream.new(path)
117
+ reader = ORCFileReader.new(input)
118
+ field_indexes = @options[:field_indexes]
119
+ reader.set_field_indexes(field_indexes) if field_indexes
120
+ reader.read_stripes
121
+ end
122
+ end
123
+
111
124
  def load_as_csv(path)
112
125
  options = @options.dup
113
126
  options.delete(:format)