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

Function TEST

cpp/src/parquet/geospatial/statistics_test.cc:32–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30namespace parquet::geospatial {
31
32TEST(TestGeoStatistics, TestDefaults) {
33 GeoStatistics stats;
34 EXPECT_TRUE(stats.geometry_types().has_value());
35 EXPECT_EQ(stats.geometry_types().value().size(), 0);
36 EXPECT_TRUE(stats.is_valid());
37 EXPECT_THAT(stats.dimension_empty(), ::testing::ElementsAre(true, true, true, true));
38 EXPECT_THAT(stats.dimension_valid(), ::testing::ElementsAre(true, true, true, true));
39 for (int i = 0; i < kMaxDimensions; i++) {
40 EXPECT_EQ(stats.lower_bound()[i], kInf);
41 EXPECT_EQ(stats.upper_bound()[i], -kInf);
42 }
43
44 EXPECT_TRUE(stats.Equals(GeoStatistics()));
45 EXPECT_EQ(stats.ToString(),
46 "<GeoStatistics> x: empty y: empty z: empty m: empty "
47 "geometry_types: []");
48
49 // Merging empty with empty should equal empty
50 stats.Merge(GeoStatistics());
51 EXPECT_TRUE(stats.Equals(GeoStatistics()));
52
53 // There's no way to encode empty ranges in Thrift, so we pretend that we
54 // didn't calculate them.
55 auto encoded = stats.Encode();
56 EXPECT_FALSE(encoded->xy_bounds_present);
57 EXPECT_FALSE(encoded->z_bounds_present);
58 EXPECT_FALSE(encoded->m_bounds_present);
59 EXPECT_FALSE(encoded->geospatial_types_present());
60
61 // When imported, the statistics marked with everything uncalculated should
62 // be "valid" but should have individual components marked as invalid.
63 GeoStatistics valid_but_uncalculated;
64 valid_but_uncalculated.Decode(*encoded);
65
66 EXPECT_TRUE(valid_but_uncalculated.is_valid());
67 EXPECT_THAT(valid_but_uncalculated.dimension_valid(),
68 ::testing::ElementsAre(false, false, false, false));
69 EXPECT_EQ(valid_but_uncalculated.geometry_types(), std::nullopt);
70}
71
72TEST(TestGeoStatistics, TestImportEncodedWithNaN) {
73 double nan_dbl = std::numeric_limits<double>::quiet_NaN();

Callers

nothing calls this directly

Calls 15

GeoStatisticsClass · 0.85
MakeWKBPointFunction · 0.85
dimension_emptyMethod · 0.80
dimension_validMethod · 0.80
lower_boundMethod · 0.80
upper_boundMethod · 0.80
make_arrayMethod · 0.80
geometry_typesMethod · 0.45
sizeMethod · 0.45
valueMethod · 0.45
is_validMethod · 0.45
EqualsMethod · 0.45

Tested by

no test coverage detected