| 4278 | } |
| 4279 | |
| 4280 | void TryReadDataFile(const std::string& path, |
| 4281 | ::arrow::StatusCode expected_code = ::arrow::StatusCode::OK, |
| 4282 | const std::string& expected_message = "") { |
| 4283 | auto pool = ::arrow::default_memory_pool(); |
| 4284 | |
| 4285 | Status s; |
| 4286 | auto reader_result = FileReader::Make(pool, ParquetFileReader::OpenFile(path, false)); |
| 4287 | if (reader_result.ok()) { |
| 4288 | auto table_result = (*reader_result)->ReadTable(); |
| 4289 | s = table_result.status(); |
| 4290 | } else { |
| 4291 | s = reader_result.status(); |
| 4292 | } |
| 4293 | |
| 4294 | ASSERT_EQ(s.code(), expected_code) |
| 4295 | << "Expected reading file to return " << arrow::Status::CodeAsString(expected_code) |
| 4296 | << ", but got " << s.ToString(); |
| 4297 | |
| 4298 | if (!expected_message.empty()) { |
| 4299 | ASSERT_EQ(s.message().find(expected_message), 0) |
| 4300 | << "Expected an error message beginning with '" << expected_message |
| 4301 | << "', but got '" << s.message() << "'"; |
| 4302 | } |
| 4303 | } |
| 4304 | |
| 4305 | TEST(TestArrowReaderAdHoc, Int96BadMemoryAccess) { |
| 4306 | // PARQUET-995 |