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

Class TestTable

c_glib/test/test-table.rb:18–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16# under the License.
17
18class TestTable < Test::Unit::TestCase
19 include Helper::Buildable
20 include Helper::Omittable
21
22 sub_test_case(".new") do
23 def setup
24 @fields = [
25 Arrow::Field.new("visible", Arrow::BooleanDataType.new),
26 Arrow::Field.new("valid", Arrow::BooleanDataType.new),
27 ]
28 @schema = Arrow::Schema.new(@fields)
29 end
30
31 def dump_table(table)
32 table.n_columns.times.collect do |i|
33 field = table.schema.get_field(i)
34 chunked_array = table.get_column_data(i)
35 values = []
36 chunked_array.chunks.each do |chunk|
37 chunk.length.times do |j|
38 values << chunk.get_value(j)
39 end
40 end
41 [
42 field.name,
43 values,
44 ]
45 end
46 end
47
48 def test_arrays
49 require_gi_bindings(3, 3, 1)
50 arrays = [
51 build_boolean_array([true]),
52 build_boolean_array([false]),
53 ]
54 table = Arrow::Table.new(@schema, arrays)
55 assert_equal([
56 ["visible", [true]],
57 ["valid", [false]],
58 ],
59 dump_table(table))
60 end
61
62 def test_chunked_arrays
63 require_gi_bindings(3, 3, 1)
64 arrays = [
65 Arrow::ChunkedArray.new([build_boolean_array([true]),
66 build_boolean_array([false])]),
67 Arrow::ChunkedArray.new([build_boolean_array([false]),
68 build_boolean_array([true])]),
69 ]
70 table = Arrow::Table.new(@schema, arrays)
71 assert_equal([
72 ["visible", [true, false]],
73 ["valid", [false, true]],
74 ],
75 dump_table(table))

Callers

nothing calls this directly

Calls 7

testFunction · 0.85
read_featherFunction · 0.85
sliceMethod · 0.45
newMethod · 0.45
pathMethod · 0.45
closeMethod · 0.45
compressionMethod · 0.45

Tested by

no test coverage detected