| 158 | }; |
| 159 | |
| 160 | TEST_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 | |
| 195 | TEST_F(TestPartitioning, DefaultPartitioningIsDirectoryPartitioning) { |
| 196 | auto partitioning = Partitioning::Default(); |
no test coverage detected