MCPcopy Create free account
hub / github.com/apache/arrow / ChunkedArrayTest

Class ChunkedArrayTest

ruby/red-arrow/test/test-chunked-array.rb:18–198  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16# under the License.
17
18class ChunkedArrayTest < Test::Unit::TestCase
19 test("#each") do
20 arrays = [
21 Arrow::BooleanArray.new([true, false]),
22 Arrow::BooleanArray.new([nil, true]),
23 ]
24 chunked_array = Arrow::ChunkedArray.new(arrays)
25 assert_equal([true, false, nil, true],
26 chunked_array.to_a)
27 end
28
29 sub_test_case("#pack") do
30 test("basic array") do
31 arrays = [
32 Arrow::BooleanArray.new([true, false]),
33 Arrow::BooleanArray.new([nil, true]),
34 ]
35 chunked_array = Arrow::ChunkedArray.new(arrays)
36 packed_chunked_array = chunked_array.pack
37 assert_equal([
38 Arrow::BooleanArray,
39 [true, false, nil, true],
40 ],
41 [
42 packed_chunked_array.class,
43 packed_chunked_array.to_a,
44 ])
45 end
46
47 test("TimestampArray") do
48 type = Arrow::TimestampDataType.new(:nano)
49 arrays = [
50 Arrow::TimestampArrayBuilder.new(type).build([Time.at(0)]),
51 Arrow::TimestampArrayBuilder.new(type).build([Time.at(1)]),
52 ]
53 chunked_array = Arrow::ChunkedArray.new(arrays)
54 packed_chunked_array = chunked_array.pack
55 assert_equal([
56 Arrow::TimestampArray,
57 [Time.at(0), Time.at(1)],
58 ],
59 [
60 packed_chunked_array.class,
61 packed_chunked_array.to_a,
62 ])
63 end
64 end
65
66 sub_test_case("#==") do
67 def setup
68 arrays = [
69 Arrow::BooleanArray.new([true]),
70 Arrow::BooleanArray.new([false, true]),
71 ]
72 @chunked_array = Arrow::ChunkedArray.new(arrays)
73 end
74
75 test("Arrow::ChunkedArray") do

Callers

nothing calls this directly

Calls 9

testFunction · 0.85
filterMethod · 0.80
newMethod · 0.45
to_aMethod · 0.45
packMethod · 0.45
buildMethod · 0.45
takeMethod · 0.45
castMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected