| 64 | } |
| 65 | |
| 66 | void AssertFormat(compute::Expression expr, const std::string& expected_directory, |
| 67 | const std::string& expected_filename = "") { |
| 68 | // formatted partition expressions are bound to the schema of the dataset being |
| 69 | // written |
| 70 | ASSERT_OK_AND_ASSIGN(auto formatted, partitioning_->Format(expr)); |
| 71 | ASSERT_EQ(formatted.directory, expected_directory); |
| 72 | ASSERT_EQ(formatted.filename, expected_filename); |
| 73 | |
| 74 | // if ((formatted.filename).empty()){ |
| 75 | // formatted.filename = "format.parquet"; |
| 76 | // } |
| 77 | // ensure the formatted path round trips the relevant components of the partition |
| 78 | // expression: roundtripped should be a subset of expr |
| 79 | ASSERT_OK_AND_ASSIGN(compute::Expression roundtripped, |
| 80 | partitioning_->Parse(formatted.directory + formatted.filename)); |
| 81 | ASSERT_OK_AND_ASSIGN(roundtripped, roundtripped.Bind(*written_schema_)); |
| 82 | ASSERT_OK_AND_ASSIGN(auto simplified, SimplifyWithGuarantee(roundtripped, expr)); |
| 83 | ASSERT_EQ(simplified, literal(true)); |
| 84 | } |
| 85 | |
| 86 | void AssertInspect(const std::vector<std::string>& paths, |
| 87 | const std::vector<std::shared_ptr<Field>>& expected) { |
nothing calls this directly
no test coverage detected