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

Function TEST_F

cpp/src/arrow/dataset/partition_test.cc:160–193  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158};
159
160TEST_F(TestPartitioning, Partition) {
161 auto dataset_schema =
162 schema({field("a", int32()), field("b", utf8()), field("c", uint32())});
163
164 auto partition_schema = schema({field("a", int32()), field("b", utf8())});
165
166 auto physical_schema = schema({field("c", uint32())});
167
168 auto partitioning = std::make_shared<DirectoryPartitioning>(partition_schema);
169 std::string json = R"([{"a": 3, "b": "x", "c": 0},
170 {"a": 3, "b": "x", "c": 1},
171 {"a": 1, "b": null, "c": 2},
172 {"a": null, "b": null, "c": 3},
173 {"a": null, "b": "z", "c": 4},
174 {"a": null, "b": null, "c": 5}
175 ])";
176
177 std::vector<std::string> expected_batches = {
178 R"([{"c": 0}, {"c": 1}])",
179 R"([{"c": 2}])",
180 R"([{"c": 3}, {"c": 5}])",
181 R"([{"c": 4}])",
182 };
183
184 std::vector<compute::Expression> expected_expressions = {
185 and_(equal(field_ref("a"), literal(3)), equal(field_ref("b"), literal("x"))),
186 and_(equal(field_ref("a"), literal(1)), is_null(field_ref("b"))),
187 and_(is_null(field_ref("a")), is_null(field_ref("b"))),
188 and_(is_null(field_ref("a")), equal(field_ref("b"), literal("z"))),
189 };
190
191 AssertPartition(partitioning, dataset_schema, json, physical_schema, expected_batches,
192 expected_expressions);
193}
194
195TEST_F(TestPartitioning, DefaultPartitioningIsDirectoryPartitioning) {
196 auto partitioning = Partitioning::Default();

Callers 1

EXPECT_OK_AND_ASSIGNFunction · 0.70

Calls 15

and_Function · 0.85
equalFunction · 0.85
field_refFunction · 0.85
ArrayFromJSONFunction · 0.85
greater_equalFunction · 0.85
lessFunction · 0.85
greaterFunction · 0.85
less_equalFunction · 0.85
ASSERT_OK_AND_ASSIGNFunction · 0.70
schemaFunction · 0.50
fieldFunction · 0.50
literalFunction · 0.50

Tested by

no test coverage detected