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

Class TestArrayStatistics

c_glib/test/test-array-statistics.rb:18–85  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16# under the License.
17
18class TestArrayStatistics < Test::Unit::TestCase
19 include Helper::Buildable
20
21 def setup
22 omit("Parquet is required") unless defined?(::Parquet)
23
24 Tempfile.create(["data", ".parquet"]) do |file|
25 @file = file
26 array = build_int64_array([nil, -(2 ** 32), 2 ** 32])
27 @table = build_table("int64" => array)
28 writer = Parquet::ArrowFileWriter.new(@table.schema, @file.path)
29 chunk_size = 1024
30 writer.write_table(@table, chunk_size)
31 writer.close
32 reader = Parquet::ArrowFileReader.new(@file.path)
33 begin
34 @statistics = reader.read_table.get_column_data(0).get_chunk(0).statistics
35 yield
36 ensure
37 reader.unref
38 end
39 end
40 end
41
42 test("#has_null_count?") do
43 assert do
44 @statistics.has_null_count?
45 end
46 end
47
48 test("#null_count_exact?") do
49 assert do
50 @statistics.null_count_exact?
51 end
52 end
53
54 test("#null_count_exact") do
55 assert_equal(1, @statistics.null_count_exact)
56 end
57
58 test("#null_count_approximate") do
59 assert do
60 @statistics.null_count_approximate.nan?
61 end
62 end
63
64 test("#has_distinct_count?") do
65 assert do
66 not @statistics.has_distinct_count?
67 end
68 end
69
70 test("#distinct_count_exact?") do
71 assert do
72 not @statistics.distinct_count_exact?
73 end
74 end
75

Callers

nothing calls this directly

Calls 1

testFunction · 0.85

Tested by

no test coverage detected