]>
Commit | Line | Data |
---|---|---|
1d09f67e TL |
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 | class TestRecordBatchIterator <Test::Unit::TestCase | |
19 | include Helper::Buildable | |
20 | ||
21 | def setup | |
22 | fields = [ | |
23 | Arrow::Field.new("visible", Arrow::BooleanDataType.new), | |
24 | Arrow::Field.new("point", Arrow::Int32DataType.new), | |
25 | ] | |
26 | schema = Arrow::Schema.new(fields) | |
27 | @record_batches = [ | |
28 | [ | |
29 | build_boolean_array([true, false, true]), | |
30 | build_int32_array([1, 2, 3]), | |
31 | ], | |
32 | [ | |
33 | build_boolean_array([false, true, false, true]), | |
34 | build_int32_array([-1, -2, -3, -4]), | |
35 | ] | |
36 | ].collect do |columns| | |
37 | Arrow::RecordBatch.new(schema, columns[0].length, columns) | |
38 | end | |
39 | @iterator = Arrow::RecordBatchIterator.new(@record_batches) | |
40 | end | |
41 | ||
42 | def test_next | |
43 | assert_equal(@record_batches[0], @iterator.next) | |
44 | assert_equal(@record_batches[1], @iterator.next) | |
45 | assert_equal(nil, @iterator.next) | |
46 | end | |
47 | ||
48 | def test_to_list | |
49 | assert_equal(@record_batches, @iterator.to_list) | |
50 | end | |
51 | end |